api

package
v0.0.0-...-1d32ed5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package api contains HTTP clients for the GSD Cloud web app.

Index

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 is a thin wrapper around net/http for the web app API.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a Client pointed at a base URL (e.g. https://app.gsd.build).

func (*Client) Pair

func (c *Client) Pair(req PairRequest) (*PairResponse, error)

Pair calls POST /api/daemon/pair.

func (*Client) RefreshToken

func (c *Client) RefreshToken(req RefreshTokenRequest) (*RefreshTokenResponse, error)

RefreshToken calls POST /api/daemon/refresh-token.

type PairRequest

type PairRequest struct {
	Code             string `json:"code"`
	Hostname         string `json:"hostname"`
	OS               string `json:"os"`
	Arch             string `json:"arch"`
	DaemonVersion    string `json:"daemonVersion"`
	InstallationID   string `json:"installationId,omitempty"`
	CurrentMachineID string `json:"currentMachineId,omitempty"`
}

PairRequest is the body of POST /api/daemon/pair.

type PairResponse

type PairResponse struct {
	MachineID      string `json:"machineId"`
	AuthToken      string `json:"authToken"`
	TokenExpiresAt string `json:"tokenExpiresAt"`
	RelayURL       string `json:"relayUrl"`
}

PairResponse is the successful response from the pairing endpoint.

type RefreshTokenRequest

type RefreshTokenRequest struct {
	MachineID string `json:"machineId"`
	Token     string `json:"token"`
}

RefreshTokenRequest is the body of POST /api/daemon/refresh-token.

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AuthToken      string `json:"authToken"`
	TokenExpiresAt string `json:"tokenExpiresAt"`
}

RefreshTokenResponse is the successful response from the refresh-token endpoint.

Jump to

Keyboard shortcuts

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