api

package
v0.0.0-...-bc45db9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package api provides methods to access the XTP API.

Index

Constants

View Source
const (
	AuthHeader        = "Authorization"
	ContentTypeHeader = "Content-Type"
	ContentType       = "application/json; charset=utf-8"
	XTPTokenEnvVar    = "XTP_TOKEN"
)

Variables

View Source
var (
	ErrXTPTokenEnvVarNotSet = errors.New("env var XTP_TOKEN not set")
)

Functions

This section is empty.

Types

type AppsExtensionPointsResponse

type AppsExtensionPointsResponse struct {
	ExtensionPoints []*ExtensionPoint `json:"objects"`
	Next            *string           `json:"next,omitempty"`
	Prev            *string           `json:"prev,omitempty"`
	Total           int               `json:"total"`
	PerPage         int               `json:"perPage"`
}

AppsExtensionPointsResponse represents the response from the /apps endpoint.

func (*AppsExtensionPointsResponse) String

func (r *AppsExtensionPointsResponse) String() string

type Binding

type Binding struct {
	ID             string `json:"id"`
	ContentAddress string `json:"contentAddress"`
	UpdatedAt      string `json:"updatedAt"`
}

Binding represents an XTP Extension Point Binding.

type BindingsMap

type BindingsMap map[string]*Binding

BindingsMap represents a collection of bindings keyed by name.

type Client

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

Client represents an XTP API client.

func New

func New() *Client

New returns a new API client.

func (*Client) GetAppsExtensionPoints

func (c *Client) GetAppsExtensionPoints(appID string) (*AppsExtensionPointsResponse, error)

GetAppsExtensionPoints returns extension points for the provided App ID.

func (*Client) GetContent

func (c *Client) GetContent(address string) ([]byte, error)

GetContent gets the content at the provided address.

func (*Client) GetExtensionPointBindings

func (c *Client) GetExtensionPointBindings(ep *ExtensionPoint) (BindingsMap, error)

GetExtensionPointBindings returns extension points for the provided App ID.

func (*Client) GetURL

func (c *Client) GetURL(address string) string

GetURL returns the URL for the wasm plugin given the content address.

type ExtensionPoint

type ExtensionPoint struct {
	ID    string `json:"id"` // "pattern": "^usr_[a-z0-9]{26}$"
	Name  string `json:"name,omitempty"`
	AppID string `json:"appId,omitempty"` // "pattern": "^app_[a-z0-9]{26}$"
	// Schema *Schema `json:"schema,omitempty"` // TODO
	SchemaYaml string `json:"schemaYaml,omitempty"`
	CreatedAt  string `json:"createdAt,omitempty"` // e.g. "2024-06-26T19:58:22.674Z"
	UpdatedAt  string `json:"updatedAt,omitempty"` // e.g. "2024-06-26T19:58:22.674Z"
}

ExtensionPoint represents an extension point associated with an app.

func (*ExtensionPoint) String

func (e *ExtensionPoint) String() string

Jump to

Keyboard shortcuts

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