rest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrgSlug

func OrgSlug(vcs, org string) string

func Slug

func Slug(vcs, org, project string) string

Slug returns a project slug, including the VCS, organization, and project names

Types

type Bitbucket added in v1.1.0

type Bitbucket struct {
	ID    string `json:"id"`
	Login string `json:"login"`
}

type Client

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

func New

func New(config Config) *Client

func (*Client) DoRequest

func (c *Client) DoRequest(req *http.Request, resp interface{}) (statusCode int, err error)

func (*Client) GetCurrentLogin added in v1.0.0

func (c *Client) GetCurrentLogin() (*CurrentLogin, error)

func (*Client) GetCurrentUserFollowedProject added in v1.1.0

func (c *Client) GetCurrentUserFollowedProject() (*UserProfile, error)

Private user profile API endpoint: https://circleci.com/api/private/me

func (*Client) HasProjectEnvironmentVariable

func (c *Client) HasProjectEnvironmentVariable(vcs, org, project, name string) (bool, error)

func (*Client) ListAllContext added in v0.1.0

func (c *Client) ListAllContext(organizationSlug string) ([]Context, error)

func (*Client) ListAllInsightsWorkflowRuns added in v0.3.0

func (c *Client) ListAllInsightsWorkflowRuns(projectSlug, workflowName, branch, startDate, endDate string, logger hclog.Logger) ([]InsightsWorkflowRun, error)

func (*Client) ListContext added in v0.1.0

func (c *Client) ListContext(organizationSlug, pageToken string) (*ContextResponse, error)

func (*Client) ListContextEnvironmentVariable added in v0.1.0

func (c *Client) ListContextEnvironmentVariable(contextId, pageToken string) (*EnvironmentVariableResponse, error)

func (*Client) ListInsightsWorkflowRuns added in v0.3.0

func (c *Client) ListInsightsWorkflowRuns(projectSlug, workflowName, branch, startDate, endDate, pageToken string, logger hclog.Logger) (*InsightsWorkflowRunResponse, error)

func (*Client) ListOrganizations added in v0.1.0

func (c *Client) ListOrganizations() (*[]OrganizationResponse, error)

func (*Client) ListPipelines

func (c *Client) ListPipelines(vcs, org string) (*PipelineResponse, error)

func (*Client) ListPipelinesWorkflow

func (c *Client) ListPipelinesWorkflow(pipelineId string) (*WorkflowResponse, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, u *url.URL, payload interface{}) (req *http.Request, err error)

type Config

type Config struct {
	URL   string
	Token string
}

type Context added in v0.1.0

type Context struct {
	ID               string    `json:"id"`
	OrganizationSlug string    `json:"slug"`
	Name             string    `json:"name"`
	CreatedAt        time.Time `json:"created_at"`
}

type ContextResponse added in v0.1.0

type ContextResponse struct {
	Items         []Context `json:"items"`
	NextPageToken string    `json:"next_page_token"`
}

type CurrentLogin added in v1.0.0

type CurrentLogin struct {
	Name  string `json:"name"`
	Login string `json:"login"`
	ID    string `json:"id"`
}

type EmailAuthentication added in v1.1.0

type EmailAuthentication struct {
	Login         string `json:"login"`
	EmailVerified bool   `json:"email_verified"`
}

type EnvironmentVariable added in v0.1.0

type EnvironmentVariable struct {
	ContextID string    `json:"context_id"`
	Variable  string    `json:"variable"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type EnvironmentVariableResponse added in v0.1.0

type EnvironmentVariableResponse struct {
	Items         []EnvironmentVariable `json:"items"`
	NextPageToken string                `json:"next_page_token"`
}

type FollowedProject added in v1.1.0

type FollowedProject struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Slug  string `json:"slug"`
	OrgID string `json:"org_id"`
}

type HTTPError

type HTTPError struct {
	Code    int
	Message string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Identities added in v1.1.0

type Identities struct {
	Bitbucket IdentityDetails `json:"bitbucket"`
}

type IdentityDetails added in v1.1.0

type IdentityDetails struct {
	AvatarURL  string `json:"avatar_url"`
	ExternalID string `json:"external_id"`
	ID         string `json:"id"`
	Name       string `json:"name"`
	User       bool   `json:"user?"`
	Domain     string `json:"domain"`
	Type       string `json:"type"`
	Authorized bool   `json:"authorized?"`
	ProviderID string `json:"provider_id"`
	Login      string `json:"login"`
}

type InsightsWorkflowRun added in v0.3.0

type InsightsWorkflowRun struct {
	ID           string    `json:"id"`
	WorkflowName string    `json:"workflow_name"`
	ProjectSlug  string    `json:"project_slug"`
	Branch       string    `json:"branch"`
	Duration     int       `json:"duration"`
	CreatedAt    time.Time `json:"created_at"`
	StoppedAt    time.Time `json:"stopped_at"`
	CreditsUsed  int       `json:"credits_used"`
	Status       string    `json:"status"`
}

type InsightsWorkflowRunResponse added in v0.3.0

type InsightsWorkflowRunResponse struct {
	Items         []InsightsWorkflowRun `json:"items"`
	NextPageToken string                `json:"next_page_token"`
}

type OrganizationResponse added in v0.1.0

type OrganizationResponse struct {
	VcsType   string    `json:"vcs_type"`
	Slug      string    `json:"slug"`
	Name      string    `json:"name"`
	ID        string    `json:"id"`
	AvatarURL string    `json:"avatar_url"`
	Contexts  []Context `json:"context"`
}

type PipelineResponse

type PipelineResponse struct {
	Items []struct {
		ID     string `json:"id"`
		Errors []struct {
			Type    string `json:"type"`
			Message string `json:"message"`
		} `json:"errors"`
		ProjectSlug       string                 `json:"project_slug"`
		UpdatedAt         time.Time              `json:"updated_at"`
		Number            int                    `json:"number"`
		TriggerParameters map[string]interface{} `json:"trigger_parameters"`
		State             string                 `json:"state"`
		CreatedAt         time.Time              `json:"created_at"`
		Trigger           struct {
			Type       string    `json:"type"`
			ReceivedAt time.Time `json:"received_at"`
			Actor      struct {
				Login     string `json:"login"`
				AvatarURL string `json:"avatar_url"`
			} `json:"actor"`
		} `json:"trigger"`
		Vcs struct {
			ProviderName        string `json:"provider_name"`
			TargetRepositoryURL string `json:"target_repository_url"`
			Branch              string `json:"branch"`
			ReviewID            string `json:"review_id"`
			ReviewURL           string `json:"review_url"`
			Revision            string `json:"revision"`
			Tag                 string `json:"tag"`
			Commit              struct {
				Subject string `json:"subject"`
				Body    string `json:"body"`
			} `json:"commit"`
			OriginRepositoryURL string `json:"origin_repository_url"`
		} `json:"vcs"`
	} `json:"items"`
	NextPageToken string `json:"next_page_token"`
}

type UserProfile added in v1.1.0

type UserProfile struct {
	EnrolledBetas            []interface{}          `json:"enrolled_betas"`
	InBetaProgram            bool                   `json:"in_beta_program"`
	SelectedEmail            string                 `json:"selected_email"`
	AvatarURL                *string                `json:"avatar_url"`
	TrialEnd                 string                 `json:"trial_end"`
	Admin                    bool                   `json:"admin"`
	BasicEmailPrefs          string                 `json:"basic_email_prefs"`
	SignInCount              int                    `json:"sign_in_count"`
	EmailAuthentication      EmailAuthentication    `json:"email_authentication"`
	AnalyticsID              string                 `json:"analytics_id"`
	Name                     string                 `json:"name"`
	GravatarID               *string                `json:"gravatar_id"`
	FollowedProjects         []FollowedProject      `json:"followed_projects"`
	DaysLeftInTrial          int                    `json:"days_left_in_trial"`
	PrivacyOptout            bool                   `json:"privacy_optout"`
	Parallelism              int                    `json:"parallelism"`
	Student                  bool                   `json:"student"`
	BitbucketAuthorized      bool                   `json:"bitbucket_authorized"`
	WebUIPipelinesOptout     string                 `json:"web_ui_pipelines_optout"`
	Bitbucket                Bitbucket              `json:"bitbucket"`
	DevAdmin                 bool                   `json:"dev_admin"`
	AllEmails                []string               `json:"all_emails"`
	CreatedAt                string                 `json:"created_at"`
	Identities               Identities             `json:"identities"`
	Login                    string                 `json:"login"`
	OrganizationPrefs        map[string]interface{} `json:"organization_prefs"`
	PusherID                 string                 `json:"pusher_id"`
	WebUIPipelinesFirstOptIn bool                   `json:"web_ui_pipelines_first_opt_in"`
	NumProjectsFollowed      int                    `json:"num_projects_followed"`
}

type Workflow added in v0.3.0

type Workflow struct {
	PipelineID     string    `json:"pipeline_id"`
	CanceledBy     string    `json:"canceled_by"`
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	ProjectSlug    string    `json:"project_slug"`
	ErroredBy      string    `json:"errored_by"`
	Tag            string    `json:"tag"`
	Status         string    `json:"status"`
	StartedBy      string    `json:"started_by"`
	PipelineNumber int       `json:"pipeline_number"`
	CreatedAt      time.Time `json:"created_at"`
	StoppedAt      time.Time `json:"stopped_at"`
}

type WorkflowResponse

type WorkflowResponse struct {
	Items         []Workflow `json:"items"`
	NextPageToken string     `json:"next_page_token"`
}

Jump to

Keyboard shortcuts

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