client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package client provides a server-side Platform93 machine client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename      string `json:"filename"`
	ContentType   string `json:"content_type"`
	ContentBase64 string `json:"content_base64"`
}

type BillingProfile

type BillingProfile struct {
	ID               string  `json:"id"`
	SubjectType      string  `json:"subject_type"`
	SubjectID        string  `json:"subject_id"`
	Name             *string `json:"name"`
	Email            *string `json:"email"`
	TaxID            *string `json:"tax_id"`
	DefaultAddressID *string `json:"default_address_id"`
	Version          int64   `json:"version"`
}

type BillingSummary

type BillingSummary struct {
	SubjectType    string          `json:"subject_type"`
	SubjectID      string          `json:"subject_id"`
	BillingProfile *BillingProfile `json:"billing_profile"`
	Subscriptions  []Subscription  `json:"subscriptions"`
}

type Client

type Client struct {
	BaseURL       string
	ApplicationID string
	ClientID      string
	ClientSecret  string
	Scopes        []string
	HTTPClient    *http.Client
	// contains filtered or unexported fields
}

func (*Client) CreateInvitation

func (c *Client) CreateInvitation(ctx context.Context, input CreateInvitation) (Invitation, error)

func (*Client) GetInvitation

func (c *Client) GetInvitation(ctx context.Context, id string) (Invitation, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id string) (User, error)

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(ctx context.Context, id string) (Workspace, error)

func (*Client) GetWorkspaceAccess

func (c *Client) GetWorkspaceAccess(ctx context.Context, id string) (Page[WorkspaceAccess], error)

func (*Client) ListInvitations

func (c *Client) ListInvitations(ctx context.Context) (Page[Invitation], error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) (Page[User], error)

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(ctx context.Context) (Page[Workspace], error)

func (*Client) PublishEvent

func (c *Client) PublishEvent(ctx context.Context, input CustomEvent, idempotencyKey string) (PublishedEvent, error)

func (*Client) ResendInvitation

func (c *Client) ResendInvitation(ctx context.Context, id string) (Invitation, error)

func (*Client) RevokeInvitation

func (c *Client) RevokeInvitation(ctx context.Context, id string) error

func (*Client) SendNotification

func (c *Client) SendNotification(ctx context.Context, input Notification, idempotencyKey string) (QueuedNotification, error)

func (*Client) SubjectBilling

func (c *Client) SubjectBilling(ctx context.Context, subjectType, subjectID string) (BillingSummary, error)

func (*Client) SubjectEntitlements

func (c *Client) SubjectEntitlements(ctx context.Context, subjectType, subjectID string) (Page[EntitlementGrant], error)

func (*Client) UpdateSecret

func (c *Client) UpdateSecret(secret string)

type CreateInvitation

type CreateInvitation struct {
	Email               string   `json:"email"`
	WorkspaceID         string   `json:"workspace_id,omitempty"`
	ApplicationRoleKeys []string `json:"application_role_keys,omitempty"`
	WorkspaceRoleKeys   []string `json:"workspace_role_keys,omitempty"`
	ExpiresIn           int64    `json:"expires_in,omitempty"`
}

type CustomEvent

type CustomEvent struct {
	Type          string          `json:"type"`
	Subject       string          `json:"subject"`
	Data          json.RawMessage `json:"data"`
	CorrelationID string          `json:"correlation_id,omitempty"`
	CausationID   string          `json:"causation_id,omitempty"`
}

type EntitlementGrant

type EntitlementGrant struct {
	ID                string          `json:"id"`
	SubjectType       string          `json:"subject_type"`
	SubjectID         string          `json:"subject_id"`
	SourceType        string          `json:"source_type"`
	SourceID          *string         `json:"source_id"`
	FeatureValues     json.RawMessage `json:"feature_values"`
	Configuration     json.RawMessage `json:"configuration"`
	StartsAt          time.Time       `json:"starts_at"`
	ExpiresAt         *time.Time      `json:"expires_at"`
	RevokedAt         *time.Time      `json:"revoked_at"`
	ExternalReference *string         `json:"external_reference"`
}

type Invitation

type Invitation struct {
	ID                  string     `json:"id"`
	Email               string     `json:"email"`
	WorkspaceID         *string    `json:"workspace_id"`
	ApplicationRoleKeys []string   `json:"application_role_keys"`
	WorkspaceRoleKeys   []string   `json:"workspace_role_keys"`
	Status              string     `json:"status"`
	ExpiresAt           time.Time  `json:"expires_at"`
	LastSentAt          time.Time  `json:"last_sent_at"`
	ResendAvailableAt   time.Time  `json:"resend_available_at"`
	AcceptedAt          *time.Time `json:"accepted_at"`
	RevokedAt           *time.Time `json:"revoked_at"`
}

type Notification

type Notification struct {
	TemplateKey string         `json:"template_key"`
	UserID      string         `json:"user_id,omitempty"`
	Recipient   string         `json:"recipient,omitempty"`
	Locale      string         `json:"locale,omitempty"`
	Variables   map[string]any `json:"variables,omitempty"`
	Attachments []Attachment   `json:"attachments,omitempty"`
}

type Page

type Page[T any] struct {
	Items      []T     `json:"items"`
	NextCursor *string `json:"next_cursor"`
}

type PublishedEvent

type PublishedEvent struct {
	ID            string          `json:"id"`
	SpecVersion   string          `json:"specversion"`
	Source        string          `json:"source"`
	Type          string          `json:"type"`
	Subject       string          `json:"subject"`
	SchemaVersion string          `json:"schema_version"`
	Data          json.RawMessage `json:"data"`
}

type QueuedNotification

type QueuedNotification struct {
	ID              string `json:"id"`
	Status          string `json:"status"`
	RequestedLocale string `json:"requested_locale"`
	ResolvedLocale  string `json:"resolved_locale"`
	FallbackUsed    bool   `json:"fallback_used"`
}

type Subscription

type Subscription struct {
	ID                string     `json:"id"`
	SubjectType       string     `json:"subject_type"`
	SubjectID         string     `json:"subject_id"`
	PriceID           string     `json:"price_id"`
	ProviderID        string     `json:"provider_id"`
	Status            string     `json:"status"`
	CurrentPeriodEnd  *time.Time `json:"current_period_end"`
	CancelAtPeriodEnd bool       `json:"cancel_at_period_end"`
	ExternalReference *string    `json:"external_reference"`
}

type User

type User struct {
	ID               string          `json:"id"`
	ApplicationID    string          `json:"application_id"`
	Email            string          `json:"email"`
	FirstName        string          `json:"first_name"`
	LastName         string          `json:"last_name"`
	Username         *string         `json:"username"`
	Locale           string          `json:"locale"`
	EmailVerified    bool            `json:"email_verified"`
	OrganizationOK   bool            `json:"is_org_verified"`
	Status           string          `json:"status"`
	CustomAttributes json.RawMessage `json:"custom_attributes"`
	Version          int64           `json:"version"`
}

type Workspace

type Workspace struct {
	ID            string          `json:"id"`
	ApplicationID string          `json:"application_id"`
	OwnerUserID   string          `json:"owner_user_id"`
	Key           string          `json:"key"`
	Name          string          `json:"name"`
	Metadata      json.RawMessage `json:"metadata"`
	Status        string          `json:"status"`
	Version       int64           `json:"version"`
	CreatedAt     time.Time       `json:"created_at"`
	UpdatedAt     time.Time       `json:"updated_at"`
}

type WorkspaceAccess

type WorkspaceAccess struct {
	Type         string     `json:"type"`
	WorkspaceID  string     `json:"workspace_id"`
	UserID       *string    `json:"user_id"`
	Email        *string    `json:"email"`
	RoleKeys     []string   `json:"role_keys"`
	InvitationID *string    `json:"invitation_id"`
	Status       string     `json:"status"`
	ExpiresAt    *time.Time `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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