v2

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package v2 Access to the API v2 of SemaphoreCI.

Reference: http://semaphoreci.com/docs/api-v2-overview.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string

	ConfigFiles   *ConfigFilesService
	EnvVars       *EnvVarsService
	Organizations *OrganizationsService
	Projects      *ProjectsService
	Secrets       *SecretsService
	Teams         *TeamsService
	Users         *UsersService
	// contains filtered or unexported fields
}

Client API v2 client

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient creates a new API v2 client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do execute a request

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error)

NewRequest creates a request

type ConfigFile

type ConfigFile struct {
	ID        string     `json:"id"`
	Path      string     `json:"path"`
	URL       string     `json:"url"`
	Content   string     `json:"content"`
	Shared    bool       `json:"shared"`
	Encrypted bool       `json:"encrypted"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

ConfigFile An API configuration file representation

type ConfigFilesService

type ConfigFilesService service

ConfigFilesService http://semaphoreci.com/docs/api-v2-config-files.html

func (*ConfigFilesService) Get

func (c *ConfigFilesService) Get(configFileID string) (*ConfigFile, *Response, error)

Get Get a config file http://semaphoreci.com/docs/api-v2-config-files.html#get-a-config-file

func (*ConfigFilesService) GetByProject

func (c *ConfigFilesService) GetByProject(projectID string) ([]ConfigFile, *Response, error)

GetByProject List config files connected to a project http://semaphoreci.com/docs/api-v2-config-files.html#list-config-files-connected-to-a-project

func (*ConfigFilesService) GetBySecret

func (c *ConfigFilesService) GetBySecret(secretID string) ([]ConfigFile, *Response, error)

GetBySecret List config files belonging to a secret http://semaphoreci.com/docs/api-v2-config-files.html#list-config-files-belonging-to-a-secret

type EnvVar

type EnvVar struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	URL       string     `json:"url"`
	Content   string     `json:"content"`
	Shared    bool       `json:"shared"`
	Encrypted bool       `json:"encrypted"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

EnvVar An API environment variables representation

type EnvVarsService

type EnvVarsService service

EnvVarsService http://semaphoreci.com/docs/api-v2-env-vars.html

func (*EnvVarsService) Get

func (c *EnvVarsService) Get(envVarID string) (*EnvVar, *Response, error)

Get Get an environment variable http://semaphoreci.com/docs/api-v2-env-vars.html#get-an-environment-variable

func (*EnvVarsService) GetByProject

func (c *EnvVarsService) GetByProject(projectID string) ([]EnvVar, *Response, error)

GetByProject List environment variables connected to a project http://semaphoreci.com/docs/api-v2-env-vars.html#list-environment-variables-connected-to-a-project

func (*EnvVarsService) GetBySecret

func (c *EnvVarsService) GetBySecret(secretID string) ([]EnvVar, *Response, error)

GetBySecret List environment variables belonging to a secret http://semaphoreci.com/docs/api-v2-env-vars.html#list-environment-variables-belonging-to-a-secret

type ErrorResponse

type ErrorResponse struct {
	Response         *http.Response    `json:"-"`
	Message          string            `json:"message,omitempty"`
	DocumentationURL string            `json:"documentation_url,omitempty"`
	Errors           []ErrorValidation `json:"errors,omitempty"`
}

ErrorResponse An API error representation

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type ErrorValidation

type ErrorValidation struct {
	Resource string `json:"resource"`
	Field    string `json:"field"`
	Code     string `json:"code"`
}

ErrorValidation An API validation error representation

type Organization

type Organization struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	URL         string     `json:"url"`
	ProjectsURL string     `json:"projects_url"`
	SecretsURL  string     `json:"secrets_url"`
	UsersURL    string     `json:"users_url"`
	TeamsURL    string     `json:"teams_url"`
	Username    string     `json:"username"`
	CreatedAt   *time.Time `json:"created_at"`
	UpdatedAt   *time.Time `json:"updated_at"`
}

Organization An API organization representation

type OrganizationsService

type OrganizationsService service

OrganizationsService http://semaphoreci.com/docs/api-v2-orgs.html

func (*OrganizationsService) Get

func (c *OrganizationsService) Get(username string) (*Organization, *Response, error)

Get Get an organization http://semaphoreci.com/docs/api-v2-orgs.html#get-an-organization

func (*OrganizationsService) GetYours

func (c *OrganizationsService) GetYours() ([]Organization, *Response, error)

GetYours List your organizations http://semaphoreci.com/docs/api-v2-orgs.html#list-your-organizations

type Project

type Project struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	HTMLURL    string     `json:"html_url"`
	UsersURL   string     `json:"users_url"`
	SecretsURL string     `json:"secrets_url"`
	UpdatedAt  *time.Time `json:"updated_at"`
	CreatedAt  *time.Time `json:"created_at"`
}

Project An API project representation

type ProjectsService

type ProjectsService service

ProjectsService http://semaphoreci.com/docs/api-v2-projects.html

func (*ProjectsService) GetByOrg

func (c *ProjectsService) GetByOrg(orgUsername string) ([]Project, *Response, error)

GetByOrg List projects in an organization http://semaphoreci.com/docs/api-v2-projects.html#list-projects-in-an-organization

func (*ProjectsService) GetBySecret

func (c *ProjectsService) GetBySecret(secretID string) ([]Project, *Response, error)

GetBySecret List projects for a secret http://semaphoreci.com/docs/api-v2-projects.html#list-projects-for-a-secret

func (*ProjectsService) GetByTeam

func (c *ProjectsService) GetByTeam(teamID string) ([]Project, *Response, error)

GetByTeam List project added to a team http://semaphoreci.com/docs/api-v2-projects.html#list-project-added-to-a-team

type Rate

type Rate struct {
	Limit     int       `json:"limit"`
	Remaining int       `json:"remaining"`
	Reset     time.Time `json:"reset"`
}

Rate a rate limit representation

type RateLimitError

type RateLimitError struct {
	Rate     Rate
	Response *http.Response
	Message  string `json:"message"`
}

RateLimitError An API rate limit error representation

func (*RateLimitError) Error

func (r *RateLimitError) Error() string

type Response

type Response struct {
	*http.Response

	PerPage   int
	Total     int
	NextPage  int
	PrevPage  int
	FirstPage int
	LastPage  int

	Rate
}

Response API response

type Secret

type Secret struct {
	ID             string     `json:"id"`
	Name           string     `json:"name"`
	Description    string     `json:"description"`
	URL            string     `json:"url"`
	ProjectsURL    string     `json:"projects_url"`
	TeamsURL       string     `json:"teams_url"`
	EnvVarsURL     string     `json:"env_vars_url"`
	ConfigFilesURL string     `json:"config_files_url"`
	CreatedAt      *time.Time `json:"created_at"`
	UpdatedAt      *time.Time `json:"updated_at"`
}

Secret An API secret representation

type SecretsService

type SecretsService service

SecretsService http://semaphoreci.com/docs/api-v2-secrets.html

func (*SecretsService) Get

func (c *SecretsService) Get(secretID string) (*Secret, *Response, error)

Get Get a secret http://semaphoreci.com/docs/api-v2-secrets.html#get-a-secret

func (*SecretsService) GetByOrg

func (c *SecretsService) GetByOrg(orgUsername string) ([]Secret, *Response, error)

GetByOrg List secrets in an organization http://semaphoreci.com/docs/api-v2-secrets.html#list-secrets-in-an-organization

func (*SecretsService) GetByProject

func (c *SecretsService) GetByProject(projectID string) ([]Secret, *Response, error)

GetByProject List secrets attached to a project http://semaphoreci.com/docs/api-v2-secrets.html#list-secrets-attached-to-a-project

func (*SecretsService) GetByTeam

func (c *SecretsService) GetByTeam(teamID string) ([]Secret, *Response, error)

GetByTeam List secrets in a team http://semaphoreci.com/docs/api-v2-secrets.html#list-secrets-in-a-team

type Team

type Team struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	URL         string     `json:"url"`
	Permission  string     `json:"permission"`
	UsersURL    string     `json:"users_url"`
	ProjectsURL string     `json:"projects_url"`
	SecretsURL  string     `json:"secrets_url"`
	CreatedAt   *time.Time `json:"created_at"`
	UpdatedAt   *time.Time `json:"updated_at"`
}

Team An API team representation

type TeamsService

type TeamsService service

TeamsService http://semaphoreci.com/docs/api-v2-teams.html

func (*TeamsService) Get

func (c *TeamsService) Get(teamID string) (*Team, *Response, error)

Get Get a team http://semaphoreci.com/docs/api-v2-teams.html#get-a-team

func (*TeamsService) GetByOrg

func (c *TeamsService) GetByOrg(orgUsername string) ([]Team, *Response, error)

GetByOrg List teams in an organization http://semaphoreci.com/docs/api-v2-teams.html#list-teams-in-an-organization

func (*TeamsService) GetByProject

func (c *TeamsService) GetByProject(projectID string) ([]Team, *Response, error)

GetByProject List all teams connected to project http://semaphoreci.com/docs/api-v2-teams.html#list-all-teams-connected-to-project

func (*TeamsService) GetBySecret

func (c *TeamsService) GetBySecret(secretID string) ([]Team, *Response, error)

GetBySecret List teams for a secret http://semaphoreci.com/docs/api-v2-teams.html#list-teams-for-a-secret

type TokenTransport

type TokenTransport struct {
	Token string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

TokenTransport HTTP transport for API authentication

func (*TokenTransport) Client

func (t *TokenTransport) Client() *http.Client

Client Creates a new HTTP client

func (*TokenTransport) RoundTrip

func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction

type User

type User struct {
	UID       string     `json:"uid"`
	Username  string     `json:"username"`
	Name      string     `json:"name"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

User An API user representation

type UsersService

type UsersService service

UsersService http://semaphoreci.com/docs/api-v2-users.html

func (*UsersService) GetByOrg

func (c *UsersService) GetByOrg(orgUsername string) ([]User, *Response, error)

GetByOrg List all users for a organization http://semaphoreci.com/docs/api-v2-users.html#list-all-users-for-a-organization

func (*UsersService) GetByProject

func (c *UsersService) GetByProject(projectID string) ([]User, *Response, error)

GetByProject List all users for a project http://semaphoreci.com/docs/api-v2-users.html#list-all-users-for-a-project

func (*UsersService) GetByTeam

func (c *UsersService) GetByTeam(teamID string) ([]User, *Response, error)

GetByTeam List members of a team http://semaphoreci.com/docs/api-v2-users.html#list-members-of-a-team

Jump to

Keyboard shortcuts

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