api

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(cmd *cobra.Command, err error) bool

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 IsBadRequest

func IsBadRequest(err error) bool

IsBadRequest checks if the error is a bad request error

func IsNoToken

func IsNoToken(err error) bool

IsNoToken checks if the error is a no token error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if the error is a not found error

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized checks if the error is an unauthorized error

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	ErrorType  string
}

APIError represents an API error with status code and message

func (*APIError) Error

func (e *APIError) Error() string

type ApplicationItem added in v0.1.6

type ApplicationItem struct {
	ID                   string `json:"id"`
	Name                 string `json:"name"`
	GithubRepositoryName string `json:"githubRepositoryName"`
}

ApplicationItem represents a single application in the list

type Client

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

Client represents an API client for making authenticated requests

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new API client with the provided base URL and optional token

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

func (c *Client) GetApplicationEnv(organizationID, applicationID string) (map[string]string, error)

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) Logout

func (c *Client) Logout() error

Logout revokes the current token

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

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 {
	ApplicationID  string `json:"applicationId"`
	RepositoryName string `json:"repositoryName"`
	CloneURLSSH    string `json:"cloneUrlSsh"`
	CloneURLHTTPS  string `json:"cloneUrlHttps"`
}

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 {
	VersionID string `json:"versionId"`
}

CreateApplicationVersionResponse represents the response from POST /applications/versions

type ErrorResponse

type ErrorResponse struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	Message          string `json:"message"`
}

ErrorResponse represents an error response from the API

type GetApplicationByRepoRequest

type GetApplicationByRepoRequest struct {
	Owner string `json:"owner"`
	Repo  string `json:"repo"`
}

GetApplicationByRepoRequest represents the request body for GET /application/from-repo

type GetApplicationByRepoResponse

type GetApplicationByRepoResponse struct {
	ApplicationID string `json:"applicationId"`
}

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 {
	EnvVars map[string]string `json:"envVars"`
}

GetApplicationEnvResponse represents the response from POST /application/env

type GetApplicationResourcesResponse added in v0.1.1

type GetApplicationResourcesResponse struct {
	Resources []ResourceItem `json:"resources"`
}

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 {
	Applications []ApplicationItem `json:"applications"`
}

GetOrganizationApplicationsResponse represents the response from POST /organizations/applications

type LoginPollRequest

type LoginPollRequest struct {
	DeviceCode string `json:"device_code"`
}

LoginPollRequest represents the request body for POST /login/poll

type LoginPollResponse

type LoginPollResponse struct {
	// Pending state
	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`

	// Success state
	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 {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

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

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Organization represents an organization from the API

type OrganizationsResponse

type OrganizationsResponse struct {
	Organizations []Organization `json:"organizations"`
}

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 {
	Active bool   `json:"active"`
	UserID string `json:"user_id"`
	Email  string `json:"email"`
	Exp    int64  `json:"exp"`
}

VerifyTokenResponse represents the response from GET /verify

Jump to

Keyboard shortcuts

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