api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api is a thin typed client for the public Privasys platform API (the management service). It speaks only the documented public surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingResult added in v0.4.0

type BillingResult struct {
	Enabled bool                   `json:"enabled"`
	Data    map[string]interface{} `json:"data"`
}

BillingResult mirrors the management-service {enabled, data?} envelope used for credit-ledger reads. When billing is not configured, Enabled is false.

type Client

type Client struct {
	BaseURL string
	Token   string
	HTTP    *http.Client
}

Client calls the platform API with a bearer access token.

func New

func New(baseURL, token string) *Client

New creates a client for the given API base URL and access token.

func (*Client) AddAppOwner added in v0.3.0

func (c *Client) AddAppOwner(ctx context.Context, appID string, owner map[string]interface{}) (map[string]interface{}, error)

AddAppOwner grants a member access to an app ({sub, email?, name?}).

func (*Client) AddMember added in v0.3.0

func (c *Client) AddMember(ctx context.Context, member map[string]interface{}) (map[string]interface{}, error)

AddMember adds an account member ({sub, email?, name?, role?}).

func (*Client) Attest added in v0.3.0

func (c *Client) Attest(ctx context.Context, appID, challenge string) (map[string]interface{}, error)

Attest returns the app's attestation result (server-side RA-TLS via the management service). An optional challenge nonce switches to challenge mode.

func (*Client) BillingBalance added in v0.4.0

func (c *Client) BillingBalance(ctx context.Context) (*BillingResult, error)

BillingBalance returns the account's credit balance.

func (*Client) BillingLedger added in v0.4.0

func (c *Client) BillingLedger(ctx context.Context, limit int) (*BillingResult, error)

BillingLedger returns the credit-ledger history, optionally limited.

func (*Client) BillingPortal added in v0.4.0

func (c *Client) BillingPortal(ctx context.Context) (string, bool, error)

BillingPortal returns a Stripe Customer Portal URL.

func (*Client) BillingSubscription added in v0.4.0

func (c *Client) BillingSubscription(ctx context.Context) (map[string]interface{}, error)

BillingSubscription returns the membership subscription state.

func (*Client) BillingUsage added in v0.4.0

func (c *Client) BillingUsage(ctx context.Context, since string) (*BillingResult, error)

BillingUsage returns the usage rollup, optionally since an RFC3339 time.

func (*Client) CheckName added in v0.2.0

func (c *Client) CheckName(ctx context.Context, name string) (map[string]interface{}, error)

CheckName reports whether an app name is available.

func (*Client) Checkout added in v0.4.0

func (c *Client) Checkout(ctx context.Context, kind string) (string, bool, error)

Checkout starts a Stripe Checkout session and returns its URL. kind is "membership" or "credits".

func (*Client) CompatibleEnclaves added in v0.2.0

func (c *Client) CompatibleEnclaves(ctx context.Context, id string) ([]map[string]interface{}, error)

CompatibleEnclaves lists enclaves an app can be deployed to.

func (*Client) CreateApp added in v0.2.0

func (c *Client) CreateApp(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

CreateApp creates an app from the given request body (CreateAppRequest shape).

func (*Client) CreateVersion added in v0.2.0

func (c *Client) CreateVersion(ctx context.Context, id, commitURL string) (map[string]interface{}, error)

CreateVersion records a new version from a commit URL (build is triggered).

func (*Client) DeleteApp added in v0.2.0

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

DeleteApp deletes an app by id.

func (*Client) DeployVersion added in v0.2.0

func (c *Client) DeployVersion(ctx context.Context, id, versionID, enclaveID string) (map[string]interface{}, error)

DeployVersion deploys a version to an enclave.

func (*Client) GetAccount added in v0.3.0

func (c *Client) GetAccount(ctx context.Context) (map[string]interface{}, error)

GetAccount returns the caller's account view ({account, role, members}).

func (*Client) GetApp

func (c *Client) GetApp(ctx context.Context, id string) (map[string]interface{}, error)

GetApp returns a single app's full record.

func (*Client) ListAppOwners added in v0.3.0

func (c *Client) ListAppOwners(ctx context.Context, appID string) (map[string]interface{}, error)

ListAppOwners returns an app's team ({owners, creator_sub}).

func (*Client) ListApps

func (c *Client) ListApps(ctx context.Context) ([]map[string]interface{}, error)

ListApps returns the caller's apps as generic records (the CLI renders a stable subset of columns and can emit the full objects as JSON/YAML, so it does not pin the full server schema).

func (*Client) ListBuilds added in v0.2.0

func (c *Client) ListBuilds(ctx context.Context, id string) ([]map[string]interface{}, error)

ListBuilds returns an app's build jobs.

func (*Client) ListDeployments added in v0.2.0

func (c *Client) ListDeployments(ctx context.Context, id string) ([]map[string]interface{}, error)

ListDeployments returns an app's deployments.

func (*Client) ListMembers added in v0.3.0

func (c *Client) ListMembers(ctx context.Context) (map[string]interface{}, error)

ListMembers returns the account's members ({members, owner_sub}).

func (*Client) ListVersions added in v0.2.0

func (c *Client) ListVersions(ctx context.Context, id string) ([]map[string]interface{}, error)

ListVersions returns an app's versions.

func (*Client) MCP added in v0.2.0

func (c *Client) MCP(ctx context.Context, id string) (map[string]interface{}, error)

MCP returns the app's MCP tool manifest.

func (*Client) RPC added in v0.2.0

func (c *Client) RPC(ctx context.Context, id, function string, body interface{}) (interface{}, error)

RPC calls an app function, passing body through verbatim and returning the raw decoded result.

func (*Client) RemoveAppOwner added in v0.3.0

func (c *Client) RemoveAppOwner(ctx context.Context, appID, sub string) (map[string]interface{}, error)

RemoveAppOwner revokes a member's access to an app.

func (*Client) RemoveMember added in v0.3.0

func (c *Client) RemoveMember(ctx context.Context, sub string) (map[string]interface{}, error)

RemoveMember removes an account member.

func (*Client) Schema added in v0.2.0

func (c *Client) Schema(ctx context.Context, id string) (map[string]interface{}, error)

Schema returns the app's exported function schema (unwraps {status, schema}).

func (*Client) SetMemberRole added in v0.3.0

func (c *Client) SetMemberRole(ctx context.Context, sub, role string) (map[string]interface{}, error)

SetMemberRole changes a member's account role.

func (*Client) StopDeployment added in v0.2.0

func (c *Client) StopDeployment(ctx context.Context, id, deploymentID string, force bool) (map[string]interface{}, error)

StopDeployment stops a running deployment.

func (*Client) UpdateAccount added in v0.3.0

func (c *Client) UpdateAccount(ctx context.Context, patch map[string]interface{}) (map[string]interface{}, error)

UpdateAccount patches the account (name, domain, kind).

func (*Client) UploadCwasm added in v0.2.0

func (c *Client) UploadCwasm(ctx context.Context, id, path string) (map[string]interface{}, error)

UploadCwasm uploads a .cwasm artifact for a wasm app (multipart field "file").

func (*Client) VerifyQuote added in v0.6.0

func (c *Client) VerifyQuote(ctx context.Context, quoteBase64 string) (map[string]interface{}, error)

VerifyQuote submits a base64 TEE quote to the attestation server (via the management service) and returns the verification verdict.

Jump to

Keyboard shortcuts

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