models

package
v0.0.0-...-2c780d5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NatsterInitializedEventType = "natster_initialized"
	CatalogSharedEventType      = "catalog_shared"
	CatalogUnsharedEventType    = "catalog_unshared"
	ContextBoundEventType       = "context_bound"
	CatalogImportedEventType    = "catalog_imported"
)

Variables

Functions

func NewApiResultFail

func NewApiResultFail(msg string, code int) []byte

func NewApiResultPass

func NewApiResultPass(data interface{}) []byte

func NewTypedApiResult

func NewTypedApiResult[T any](data *T, code int, err *string) []byte

Types

type ApiResult

type ApiResult struct {
	Error *string     `json:"error,omitempty"`
	Code  int         `json:"code"`
	Data  interface{} `json:"data"`
}

type CatalogEntry

type CatalogEntry struct {
	Path        string `json:"path"`
	Description string `json:"description"`
	MimeType    string `json:"mime_type"`
	ByteSize    int64  `json:"byte_size"`
	Hash        string `json:"hash"`
}

It might feel like a good idea to just use the internal medialibrary.MediaEntry here but once we get to refactoring, that internal type will change and we'll want to insulate clients from that

type CatalogNameValidationResult

type CatalogNameValidationResult struct {
	Valid   bool   `json:"valid"`
	Message string `json:"message"`
}

type CatalogShareSummary

type CatalogShareSummary struct {
	FromAccount   string `json:"from_account"`
	ToAccount     string `json:"to_account"`
	Catalog       string `json:"catalog"`
	CatalogOnline bool   `json:"catalog_online"`
	Revision      int64  `json:"revision"`
}

type CatalogSummary

type CatalogSummary struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Image       string         `json:"image,omitempty"`
	Entries     []CatalogEntry `json:"entries"`
}

type ClaimOpts

type ClaimOpts struct {
	Code          string
	OAuthIdentity string
}

type CommunityStats

type CommunityStats struct {
	TotalInitialized uint64 `json:"total_initialized"`
	RunningCatalogs  uint64 `json:"running_catalogs"`
	// Total number of catalogs shared with others
	SharedCatalogs uint64 `json:"share_count"`
}

type ContextBoundEvent

type ContextBoundEvent struct {
	OAuthIdentity string         `json:"oauth_id"`
	BoundContext  NatsterContext `json:"bound_context"`
}

Occurs when someone with an OAuth ID claims a one-time code, resulting in a binding between the context originally submitted with the code and the OAuth ID, which in turn allows that web user to access their natster resources

type ContextQueryResponse

type ContextQueryResponse struct {
	Context  NatsterContext `json:"context"`
	UserJwt  string         `json:"user_jwt"`
	UserSeed string         `json:"user_seed"`
}

type DownloadOptions

type DownloadOptions struct {
	Hash       string
	OutputPath string
}

type DownloadRequest

type DownloadRequest struct {
	Hash       string `json:"hash"`
	Transcode  bool   `json:"transcode"`
	TargetXkey string `json:"target_xkey"`
}

type DownloadResponse

type DownloadResponse struct {
	Acknowledged bool   `json:"acknowledged"`
	ChunkSize    uint   `json:"chunk_size"`
	TotalChunks  uint   `json:"total_chunks"`
	SenderXKey   string `json:"sender_xkey"`
	TotalBytes   uint   `json:"total_bytes"`
}

type Heartbeat

type Heartbeat struct {
	Catalog    string `json:"catalog"`
	AccountKey string `json:"account_key"`
	Revision   int64  `json:"revision"`
}

Heartbeats are emitted to the global service periodically by running natster catalog servers

type HubOptions

type HubOptions struct {
	Name        string
	Description string
	RootPath    string
	AllowAll    bool
}

type InitOptions

type InitOptions struct {
	// Personal access token created in synadia cloud
	Token string
}

type NatsterContext

type NatsterContext struct {
	TeamID           string `json:"team_id"`
	SystemID         string `json:"system_id"`
	AccountID        string `json:"account_id"`
	AccountName      string `json:"account_name"`
	AccountPublicKey string `json:"account_public_key"`
	Token            string `json:"access_token"`
	UserID           string `json:"user_id"`
	CredsPath        string `json:"creds"`
}

type NatsterEvent

type NatsterEvent struct {
	Catalog   string      `json:"catalog"`
	Target    string      `json:"target"`
	EventType string      `json:"event_type"`
	Data      interface{} `json:"data,omitempty"`
}

Events are emitted by the natster server process

type NatsterInitializedEvent

type NatsterInitializedEvent struct {
	AccountId   string `json:"account_id"`
	AccountName string `json:"account_name"`
	AccountKey  string `json:"account_key"`
}

type Options

type Options struct {
	// Creds is nats credentials to authenticate with
	Creds string
	// Timeout is how long to wait for operations
	Timeout time.Duration
	// Context in which action is to be performed
	ContextName string
}

Options configure the CLI

type OtcClaimRequest

type OtcClaimRequest struct {
	Code          string `json:"code"`
	OAuthIdentity string `json:"oauth_id"`
}

type OtcGenerateResponse

type OtcGenerateResponse struct {
	Code         string `json:"code"`
	ValidMinutes int    `json:"valid_minutes"`
	ClaimUrl     string `json:"claim_url"`
}

type ShareOptions

type ShareOptions struct {
	Name       string
	AccountKey string
}

type TypedApiResult

type TypedApiResult[T any] struct {
	Error *string `json:"error,omitempty"`
	Code  int     `json:"code"`
	Data  *T      `json:"data,omitempty"`
}

type WebLoginOpts

type WebLoginOpts struct {
	DisplayQR bool
}

type WhoamiResponse

type WhoamiResponse struct {
	AccountKey    string  `json:"account_key"`
	OAuthIdentity *string `json:"oauth_id,omitempty"`
	Initialized   int64   `json:"initialized"`
}

Jump to

Keyboard shortcuts

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