create

package
v0.0.0-...-69be096 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetSampleRepos = func(client Sampler) ([]GithubRepo, error) {
	repos, err := getSampleReposFromSlack(client)
	if err != nil || len(repos) == 0 {
		repos, err = getSampleReposFromGitHub(client)
		if err != nil {
			return []GithubRepo{}, slackerror.Wrap(err, slackerror.ErrSampleCreate)
		}
	}
	return repos, nil
}

GetSampleRepos requests a list of samples from Slack API and falls back to the GitHub API

Functions

func Create

func Create(ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, createArgs CreateArgs) (appDirPath string, err error)

Create will create a new Slack app on the file system and app manifest on the Slack API.

func InstallProjectDependencies

func InstallProjectDependencies(
	ctx context.Context,
	clients *shared.ClientFactory,
	projectDirPath string,
	manifestSource config.ManifestSource,
) []string

InstallProjectDependencies installs the project runtime dependencies or continues with next steps if that fails. You can specify the manifestSource for the project configuration file (default: ManifestSourceLocal)

Types

type CreateArgs

type CreateArgs struct {
	AppName   string
	Template  Template
	GitBranch string
}

CreateArgs are the arguments passed into the Create function

type GithubRepo

type GithubRepo struct {
	ID              int
	Name            string
	FullName        string `json:"full_name"`
	Description     string
	Language        string
	CreatedAt       string `json:"created_at"`
	StargazersCount int    `json:"stargazers_count"`
}

GithubRepo is the single repository data structure

type Sampler

type Sampler interface {
	Do(req *http.Request) (res *http.Response, err error)
}

Sampler requests samples from various URLs

type SamplerMock

type SamplerMock struct {
	mock.Mock
}

func NewMockSampler

func NewMockSampler() *SamplerMock

func (*SamplerMock) Do

func (s *SamplerMock) Do(req *http.Request) (*http.Response, error)

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template describes the app template's path and protocol

func ResolveTemplateURL

func ResolveTemplateURL(templateURL string) (Template, error)

ResolveTemplateURL returns a git-clone compatible URL

func (Template) GetTemplatePath

func (t Template) GetTemplatePath() string

GetTemplatePath returns the path a template is located at

Templates on GitHub use an abbreviated format for concise outputs

func (Template) IsSample

func (t Template) IsSample() bool

IsSample returns if the complete URL points to a sample template

func (Template) IsTrusted

func (t Template) IsTrusted() bool

IsTrusted returns if the template is cloned from a trusted source

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL