Documentation
¶
Index ¶
- type Client
- func (c *Client) AgreeToContract(contractID string) error
- func (c *Client) DownloadLatestSdk(targetDir string) (string, error)
- func (c *Client) DownloadSdkByVersionID(targetDir, versionID string) (string, error)
- func (c *Client) FetchEnvironmentInfoByHumanID(humanID string) (*EnvironmentInfo, error)
- func (c *Client) FetchProjectEnvironments(projectUUID string) ([]EnvironmentInfo, error)
- func (c *Client) FetchProjectInfo(projectHumanID string) (*ProjectInfo, error)
- func (c *Client) FetchUserOrgsAndProjects() ([]OrganizationWithProjects, error)
- func (c *Client) FindSdkVersionByVersionOrName(versionOrName string) (*SdkVersionInfo, error)
- func (c *Client) GetLatestSdkVersionInfo() (*SdkVersionInfo, error)
- func (c *Client) GetSdkVersions() ([]SdkVersionInfo, error)
- func (c *Client) GetUserState() (*UserState, error)
- type EnvironmentInfo
- type EnvironmentType
- type HostingType
- type OrganizationWithProjects
- type ProjectInfo
- type ProjectTier
- type SdkVersionInfo
- type SupportTier
- type UserCoreContract
- type UserProfile
- type UserState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Portal API client that handles authentication and requests.
func (*Client) AgreeToContract ¶
User has agreed to the contents of a specific contract. Update the status to the portal.
func (*Client) DownloadLatestSdk ¶
DownloadLatestSdk downloads the latest SDK to the specified target directory. This is a convenience function that combines GetLatestSdkVersionInfo and DownloadSdkByVersionId.
func (*Client) DownloadSdkByVersionID ¶
DownloadSdkByVersionID downloads the SDK with the specified version ID to the target directory.
func (*Client) FetchEnvironmentInfoByHumanID ¶
func (c *Client) FetchEnvironmentInfoByHumanID(humanID string) (*EnvironmentInfo, error)
FetchEnvironmentInfoByHumanID fetches information about an environment using its human ID.
func (*Client) FetchProjectEnvironments ¶
func (c *Client) FetchProjectEnvironments(projectUUID string) ([]EnvironmentInfo, error)
FetchProjectEnvironments fetches all environments for the given project.
func (*Client) FetchProjectInfo ¶
func (c *Client) FetchProjectInfo(projectHumanID string) (*ProjectInfo, error)
FetchProjectInfo fetches information about a project using its human ID.
func (*Client) FetchUserOrgsAndProjects ¶
func (c *Client) FetchUserOrgsAndProjects() ([]OrganizationWithProjects, error)
Fetch the organizations and projects (within each org) that the user has access to. Note: It's considered an error if the user has no accessible organizations.
func (*Client) FindSdkVersionByVersionOrName ¶
func (c *Client) FindSdkVersionByVersionOrName(versionOrName string) (*SdkVersionInfo, error)
FindSdkVersionByVersionOrName attempts to find an SDK version by its version string or name. If only a major version is provided (e.g., "34"), returns the latest minor/patch for that major. Returns nil if no matching version is found.
func (*Client) GetLatestSdkVersionInfo ¶
func (c *Client) GetLatestSdkVersionInfo() (*SdkVersionInfo, error)
GetLatestSdkVersionInfo retrieves information about the latest SDK version.
func (*Client) GetSdkVersions ¶
func (c *Client) GetSdkVersions() ([]SdkVersionInfo, error)
GetSdkVersions retrieves a list of all available SDK versions.
func (*Client) GetUserState ¶
Get the user's state from portal /api/v1/users/me endpoint. This includes the user profile and contract signature status.
type EnvironmentInfo ¶
type EnvironmentInfo struct {
UID string `json:"id"` // UUID of the environment
ProjectUID string `json:"project_id"` // UUID of the project that this environment belongs to
Name string `json:"name"` // User-provided name for the environment (can change)
URL string `json:"url"` // TODO: What is this URL?
CreatedAt string `json:"created_at"` // Creation time of the environment (ISO8601 string)
Type EnvironmentType `json:"type"` // Type of the environment (e.g., 'development' or 'production')
HumanID string `json:"human_id"` // Immutable human-readable identifier, eg, 'lovely-wombats-build-nimbly'
EnvDomain string `json:"env_domain"` // Domain that the environment uses
StackDomain string `json:"stack_domain"` // Domain of the infra stack
HostingType HostingType `json:"hosting_type"`
}
EnvironmentInfo represents information about an environment received from the portal.
type EnvironmentType ¶
type EnvironmentType string
Environment type (as specified by the portal).
const ( EnvironmentTypeDevelopment EnvironmentType = "development" EnvironmentTypeStaging EnvironmentType = "staging" EnvironmentTypeProduction EnvironmentType = "production" )
type HostingType ¶
type HostingType string
Type of hosting for an environment (Metaplay-hosted vs self-hosted)
const ( HostingTypeMetaplayHosted HostingType = "metaplay-hosted" HostingTypeSelfHosted HostingType = "self-hosted" )
type OrganizationWithProjects ¶
type OrganizationWithProjects struct {
UUID string `json:"id"` // UUID of the organization.
Name string `json:"name"` // Name of the organization.
CreatedAt string `json:"created_at"` // Timestamp when organization was created.
Role string `json:"role"` // User's role in the organization.
Projects []ProjectInfo `json:"projects"` // Accessible projects within the organization.
}
Type returned by GET /api/v1/organizations/user-organizations.
type ProjectInfo ¶
type ProjectInfo struct {
UUID string `json:"id"` // UUID of the project.
OrganizationUUID string `json:"organization_id"` // Owner organization UUID.
HumanID string `json:"human_id"` // Immutable human-readable identified, eg, 'gorgeous-bear'.
Name string `json:"name"` // Name of the project.
CreatedAt string `json:"created_at"` // Timestamp when the project was created.
MaxDevEnvs int `json:"max_dev_envs"` // Maximum number of development environments allowed.
MaxProdEnvs int `json:"max_prod_envs"` // Maximum number of production environments allowed.
MaxStagingEnvs int `json:"max_staging_envs"` // Maximum number of staging environments allowed.
SupportTier SupportTier `json:"support_tier"` // Support tier for the project (e.g., 'community').
Type ProjectTier `json:"type"` // Type of project (e.g., 'free').
}
ProjectInfo represents information about a project received from the portal.
type ProjectTier ¶
type ProjectTier string
Type (tier) of project.
const ( ProjectTierFree ProjectTier = "free" ProjectTierPreLaunch ProjectTier = "pre-launch" ProjectTierProduction ProjectTier = "production" ProjectTierPrivateCloud ProjectTier = "private-cloud" )
type SdkVersionInfo ¶
type SdkVersionInfo struct {
ID string `json:"id"`
Version string `json:"version"`
Name string `json:"name"`
Description *string `json:"description"`
IsPublic bool `json:"is_public"`
IsTestAsset bool `json:"is_test_asset"`
ReleaseDate *string `json:"release_date"`
ReleaseNotesURL *string `json:"release_notes_url"`
StoragePath *string `json:"storage_path"`
CreatedAt string `json:"created_at"`
}
SdkVersionInfo represents information about an SDK version
type SupportTier ¶
type SupportTier string
Project support tier.
const ( ProjectSupportTierCommunity SupportTier = "community" ProjectSupportTierNextBusinessDay SupportTier = "next-business-day" ProjectSupportTier24_7 SupportTier = "24-7" ProjectSupportTierTailored SupportTier = "tailored" ProjectSupportTierInternalTesting SupportTier = "testing-internal-only" )
type UserCoreContract ¶
type UserCoreContract struct {
Changes *string `json:"changes"`
CreatedAt string `json:"created_at"`
Description string `json:"description"`
ID string `json:"id"`
Name string `json:"name"`
OrganizationID *string `json:"organization_id"`
Type string `json:"type"`
URI string `json:"uri"`
URIType string `json:"uri_type"`
UserID *string `json:"user_id"`
Version string `json:"version"`
// Signature by the user. Nil if not signed.
ContractSignature *struct {
ID string `json:"id"`
CreatedAt string `json:"created_at"`
} `json:"contract_signature"`
}
Status of a single user contract (signed or not).
type UserProfile ¶
type UserProfile struct {
UserID string `json:"id"` // Portal user ID (different from Metaplay Auth).
}
User profile in the portal.
type UserState ¶
type UserState struct {
User UserProfile `json:"user"`
Contracts struct {
PrivacyPolicy UserCoreContract `json:"privacyPolicy"`
TermsAndConditions UserCoreContract `json:"termsAndConditions"`
} `json:"contracts"`
}
User state as returned from the /users/me endpoint on portal. Includes basic profile info as well as contract signatures.