Documentation
¶
Index ¶
- Constants
- func CheckErr(cmd *cobra.Command, err error) bool
- func GetErrorCode(err error) int
- func HasErrorCode(err error, code int) bool
- func IsAuthorizationPending(err error) bool
- func IsBadRequest(err error) bool
- func IsForceUpgrade(err error) bool
- func IsInvalidDeviceCode(err error) bool
- func IsNoToken(err error) bool
- func IsNotFound(err error) bool
- func IsTokenExpired(err error) bool
- func IsUnauthorized(err error) bool
- type APIError
- type AddGithubCollaboratorsRequest
- type AddGithubCollaboratorsResponse
- type AppErrorDetail
- type ApplicationItem
- type CheckVersionResponse
- type Client
- func (c *Client) AddGithubCollaborators(applicationID, githubUsername string) (*AddGithubCollaboratorsResponse, error)
- func (c *Client) CheckVersion(currentVersion string) (*CheckVersionResponse, error)
- func (c *Client) CreateApplication(name, description, organizationID string) (*CreateApplicationResponse, error)
- func (c *Client) CreateApplicationVersion(applicationID string) (*CreateApplicationVersionResponse, error)
- func (c *Client) GetApplicationByRepo(owner, repo string) (*GetApplicationByRepoResponse, error)
- func (c *Client) GetApplicationEnv(organizationID, applicationID string) (map[string]string, error)
- func (c *Client) GetApplicationResources(applicationID string) (*GetApplicationResourcesResponse, error)
- func (c *Client) GetOrganizationApplications(organizationID string) (*GetOrganizationApplicationsResponse, error)
- func (c *Client) GetOrganizations() (*OrganizationsResponse, error)
- func (c *Client) GetVersionStatus(applicationID, organizationID, versionID string) (*GetVersionStatusResponse, error)
- func (c *Client) Logout() error
- func (c *Client) PollLogin(deviceCode string) (*LoginPollResponse, error)
- func (c *Client) StartLogin() (*LoginStartResponse, error)
- func (c *Client) VerifyToken() (*VerifyTokenResponse, error)
- type CreateApplicationRequest
- type CreateApplicationResponse
- type CreateApplicationVersionRequest
- type CreateApplicationVersionResponse
- type ErrorResponse
- type ForceUpgradeError
- type GetApplicationByRepoRequest
- type GetApplicationByRepoResponse
- type GetApplicationEnvRequest
- type GetApplicationEnvResponse
- type GetApplicationResourcesResponse
- type GetOrganizationApplicationsRequest
- type GetOrganizationApplicationsResponse
- type GetVersionStatusRequest
- type GetVersionStatusResponse
- type LoginPollRequest
- type LoginPollResponse
- type LoginStartResponse
- type NoTokenError
- type Organization
- type OrganizationsResponse
- type ResourceItem
- type VerifyTokenResponse
- type VersionCheckRequest
Constants ¶
const ( // Authentication & Authorization Errors (2000-2099) ErrorCodeInvalidToken = 2001 // Used for expired tokens ErrorCodeInvalidUserCode = 2002 ErrorCodeTokenNotFound = 2003 ErrorCodeInvalidDeviceCode = 2004 ErrorCodeAuthorizationPending = 2005 // Organization Errors (3000-3099) ErrorCodeOrganizationNotFound = 3000 ErrorCodeNotOrgMember = 3001 ErrorCodeNoCreatePermission = 3002 // Application Errors (4000-4099) ErrorCodeApplicationNotFound = 4000 ErrorCodeNoApplicationAccess = 4001 ErrorCodeDuplicateAppName = 4002 // GitHub Integration Errors (5000-5099) ErrorCodeGitHubRepoNotFound = 5000 ErrorCodeGitHubRepoAccessDenied = 5001 ErrorCodeGitHubCollaboratorAddFailed = 5002 )
Error code constants from @repo/errors
Variables ¶
This section is empty.
Functions ¶
func CheckErr ¶
CheckErr checks for errors and prints appropriate messages using the command's output Returns true if no error (ok to continue), false if there was an error
func GetErrorCode ¶ added in v0.1.11
GetErrorCode returns the internal error code from an error, or 0 if not an APIError
func HasErrorCode ¶ added in v0.1.11
HasErrorCode checks if the error has a specific internal error code
func IsAuthorizationPending ¶ added in v0.1.11
IsAuthorizationPending checks if the error is an authorization pending error
func IsBadRequest ¶
IsBadRequest checks if the error is a bad request error
func IsForceUpgrade ¶ added in v0.1.11
IsForceUpgrade checks if the error is a force upgrade error
func IsInvalidDeviceCode ¶ added in v0.1.11
IsInvalidDeviceCode checks if the error is an invalid device code error
func IsNotFound ¶
IsNotFound checks if the error is a not found error
func IsTokenExpired ¶ added in v0.1.12
IsTokenExpired checks if the error is a token expiration error
func IsUnauthorized ¶
IsUnauthorized checks if the error is an unauthorized error
Types ¶
type APIError ¶
type APIError struct {
StatusCode int
InternalCode int // Internal error code from the API
Message string
ErrorType string
}
APIError represents an API error with status code and message
type AddGithubCollaboratorsRequest ¶ added in v0.1.9
type AddGithubCollaboratorsRequest struct {
ApplicationID string `json:"applicationId"`
GithubUsername string `json:"githubUsername"`
}
AddGithubCollaboratorsRequest represents the request body for POST /applications/add-gh-collaborators
type AddGithubCollaboratorsResponse ¶ added in v0.1.9
type AddGithubCollaboratorsResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
}
AddGithubCollaboratorsResponse represents the response from POST /applications/add-gh-collaborators
type AppErrorDetail ¶ added in v0.1.11
type AppErrorDetail struct {
InternalCode int `json:"internal_code"`
ErrorString string `json:"error_string"`
StatusCode int `json:"status_code"`
}
AppErrorDetail represents the error detail from the API (new format)
type ApplicationItem ¶ added in v0.1.6
type ApplicationItem struct {
ID string `json:"id"`
Name string `json:"name"`
GithubRepositoryName string `json:"githubRepositoryName"`
CloneURLSSH string `json:"cloneUrlSsh"`
CloneURLHTTPS string `json:"cloneUrlHttps"`
}
ApplicationItem represents a single application in the list
type CheckVersionResponse ¶ added in v0.1.11
type CheckVersionResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
ForceUpgrade bool `json:"forceUpgrade,omitempty"`
CanUpgrade bool `json:"canUpgrade,omitempty"`
LatestVersion *string `json:"latestVersion,omitempty"`
}
CheckVersionResponse represents the response from GET /version/check
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an API client for making authenticated requests
func (*Client) AddGithubCollaborators ¶ added in v0.1.9
func (c *Client) AddGithubCollaborators(applicationID, githubUsername string) (*AddGithubCollaboratorsResponse, error)
AddGithubCollaborators adds the user as a collaborator to the GitHub repository
func (*Client) CheckVersion ¶ added in v0.1.11
func (c *Client) CheckVersion(currentVersion string) (*CheckVersionResponse, error)
CheckVersion checks if the CLI version is up to date
func (*Client) CreateApplication ¶
func (c *Client) CreateApplication(name, description, organizationID string) (*CreateApplicationResponse, error)
CreateApplication creates a new application with a GitHub repository
func (*Client) CreateApplicationVersion ¶ added in v0.1.2
func (c *Client) CreateApplicationVersion(applicationID string) (*CreateApplicationVersionResponse, error)
CreateApplicationVersion creates a new version of an application
func (*Client) GetApplicationByRepo ¶
func (c *Client) GetApplicationByRepo(owner, repo string) (*GetApplicationByRepoResponse, error)
GetApplicationByRepo retrieves an application by its repository owner and name
func (*Client) GetApplicationEnv ¶
GetApplicationEnv retrieves environment variables for an application
func (*Client) GetApplicationResources ¶ added in v0.1.1
func (c *Client) GetApplicationResources(applicationID string) (*GetApplicationResourcesResponse, error)
GetApplicationResources retrieves resources for an application
func (*Client) GetOrganizationApplications ¶ added in v0.1.6
func (c *Client) GetOrganizationApplications(organizationID string) (*GetOrganizationApplicationsResponse, error)
GetOrganizationApplications retrieves all applications for an organization
func (*Client) GetOrganizations ¶
func (c *Client) GetOrganizations() (*OrganizationsResponse, error)
GetOrganizations retrieves the list of organizations for the authenticated user
func (*Client) GetVersionStatus ¶ added in v0.1.13
func (c *Client) GetVersionStatus(applicationID, organizationID, versionID string) (*GetVersionStatusResponse, error)
GetVersionStatus retrieves the deployment status of an application version
func (*Client) PollLogin ¶
func (c *Client) PollLogin(deviceCode string) (*LoginPollResponse, error)
PollLogin polls the login endpoint to check if the user has authorized the device Returns the response and error. For authorization pending state, returns a specific error.
func (*Client) StartLogin ¶
func (c *Client) StartLogin() (*LoginStartResponse, error)
StartLogin initiates the device flow login process
func (*Client) VerifyToken ¶
func (c *Client) VerifyToken() (*VerifyTokenResponse, error)
VerifyToken verifies the current token and returns user information
type CreateApplicationRequest ¶
type CreateApplicationRequest struct {
Name string `json:"name"`
Description string `json:"description"`
OrganizationID string `json:"organizationId"`
}
CreateApplicationRequest represents the request body for POST /applications
type CreateApplicationResponse ¶
type CreateApplicationResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
ApplicationID string `json:"applicationId,omitempty"`
RepositoryName string `json:"repositoryName,omitempty"`
CloneURLSSH string `json:"cloneUrlSsh,omitempty"`
CloneURLHTTPS string `json:"cloneUrlHttps,omitempty"`
}
CreateApplicationResponse represents the response from POST /applications
type CreateApplicationVersionRequest ¶ added in v0.1.2
type CreateApplicationVersionRequest struct {
ApplicationID string `json:"applicationId"`
}
CreateApplicationVersionRequest represents the request body for POST /applications/versions
type CreateApplicationVersionResponse ¶ added in v0.1.2
type CreateApplicationVersionResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
VersionID string `json:"versionId,omitempty"`
}
CreateApplicationVersionResponse represents the response from POST /applications/versions
type ErrorResponse ¶
type ErrorResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
}
ErrorResponse represents an error response from the API (new format only)
type ForceUpgradeError ¶ added in v0.1.11
type ForceUpgradeError struct {
LatestVersion string
}
ForceUpgradeError represents an error when the CLI version is too old and must be upgraded
func (*ForceUpgradeError) Error ¶ added in v0.1.11
func (e *ForceUpgradeError) Error() string
type GetApplicationByRepoRequest ¶
GetApplicationByRepoRequest represents the request body for GET /application/from-repo
type GetApplicationByRepoResponse ¶
type GetApplicationByRepoResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
ApplicationID string `json:"applicationId,omitempty"`
}
GetApplicationByRepoResponse represents the response from GET /application/from-repo
type GetApplicationEnvRequest ¶
type GetApplicationEnvRequest struct {
OrganizationID string `json:"organizationId"`
ApplicationID string `json:"applicationId"`
}
GetApplicationEnvRequest represents the request body for POST /application/env
type GetApplicationEnvResponse ¶
type GetApplicationEnvResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
EnvVars map[string]string `json:"envVars,omitempty"`
}
GetApplicationEnvResponse represents the response from POST /application/env
type GetApplicationResourcesResponse ¶ added in v0.1.1
type GetApplicationResourcesResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Resources []ResourceItem `json:"resources,omitempty"`
}
GetApplicationResourcesResponse represents the response from GET /applications/:applicationId/resources
type GetOrganizationApplicationsRequest ¶ added in v0.1.7
type GetOrganizationApplicationsRequest struct {
OrganizationID string `json:"organizationId"`
}
GetOrganizationApplicationsRequest represents the request body for POST /organizations/applications
type GetOrganizationApplicationsResponse ¶ added in v0.1.6
type GetOrganizationApplicationsResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Applications []ApplicationItem `json:"applications,omitempty"`
}
GetOrganizationApplicationsResponse represents the response from POST /organizations/applications
type GetVersionStatusRequest ¶ added in v0.1.13
type GetVersionStatusRequest struct {
ApplicationID string `json:"applicationId"`
OrganizationID string `json:"organizationId"`
VersionID string `json:"versionId"`
}
GetVersionStatusRequest represents the request body for POST /applications/versions/status
type GetVersionStatusResponse ¶ added in v0.1.13
type GetVersionStatusResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Status string `json:"status,omitempty"`
DeploymentError string `json:"deploymentError,omitempty"`
}
GetVersionStatusResponse represents the response from POST /applications/versions/status
type LoginPollRequest ¶
type LoginPollRequest struct {
DeviceCode string `json:"device_code"`
}
LoginPollRequest represents the request body for POST /login/poll
type LoginPollResponse ¶
type LoginPollResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
AccessToken string `json:"access_token,omitempty"`
TokenType string `json:"token_type,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
}
LoginPollResponse represents the response from POST /login/poll
type LoginStartResponse ¶
type LoginStartResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
DeviceCode string `json:"device_code,omitempty"`
UserCode string `json:"user_code,omitempty"`
VerificationURI string `json:"verification_uri,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
Interval int `json:"interval,omitempty"`
}
LoginStartResponse represents the response from POST /login/start
type NoTokenError ¶
type NoTokenError struct {
OriginalError error
}
NoTokenError represents an error when no token is available
func (*NoTokenError) Error ¶
func (e *NoTokenError) Error() string
type Organization ¶
Organization represents an organization from the API
type OrganizationsResponse ¶
type OrganizationsResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Organizations []Organization `json:"organizations,omitempty"`
}
OrganizationsResponse represents the response from GET /organizations
type ResourceItem ¶ added in v0.1.1
type ResourceItem struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
ResourceItem represents a single resource
type VerifyTokenResponse ¶
type VerifyTokenResponse struct {
Error *AppErrorDetail `json:"error,omitempty"`
Active bool `json:"active,omitempty"`
UserID string `json:"user_id,omitempty"`
Email string `json:"email,omitempty"`
Exp int64 `json:"exp,omitempty"`
}
VerifyTokenResponse represents the response from GET /verify
type VersionCheckRequest ¶ added in v0.1.11
type VersionCheckRequest struct {
Version string `json:"version"`
}