Documentation ¶
Index ¶
- type Client
- func (c *Client) ClaimOneTimeCode(code string, oauthIdentifier string) (*models.NatsterContext, error)
- func (c *Client) Drain()
- func (c *Client) GenerateOneTimeCode(context models.NatsterContext) (*models.OtcGenerateResponse, error)
- func (c *Client) GetBoundContextByOAuth(oauthId string) (*models.ContextQueryResponse, error)
- func (c *Client) GetMyCatalogs() (*[]models.CatalogShareSummary, error)
- func (c *Client) PublishEvent(eventType string, catalog string, target string, rawData json.RawMessage) error
- func (c *Client) PublishHeartbeat(nctx *models.NatsterContext, library *medialibrary.MediaLibrary) error
- func (c *Client) ValidateCatalogName(catalog string) (*models.CatalogNameValidationResult, error)
- func (c *Client) Whoami() (*models.WhoamiResponse, error)
- type GlobalService
- func (srv *GlobalService) AllCatalogs() ([]string, error)
- func (srv *GlobalService) CatalogRevision(catalog string) int64
- func (srv *GlobalService) CreateKeyValueContext() (jetstream.KeyValue, error)
- func (srv *GlobalService) GetBoundContext(myAccountKey string) (*models.ContextBoundEvent, error)
- func (srv *GlobalService) GetBoundContextByOAuth(oauthId string) (*models.NatsterContext, error)
- func (srv *GlobalService) GetCatalog(catalog string) (*catalogProjection, error)
- func (srv *GlobalService) GetMyCatalogs(myAccountKey string) ([]models.CatalogShareSummary, error)
- func (srv *GlobalService) GetOAuthIdForAccount(accountKey string) (*string, error)
- func (srv *GlobalService) GetTotalInitializedAccounts() (uint64, error)
- func (srv *GlobalService) GetTotalSharedCatalogs() (uint64, error)
- func (srv *GlobalService) IsCatalogOnline(catalog string) bool
- func (srv *GlobalService) Start(version, commit, date string) error
- func (srv *GlobalService) Stop() error
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
}
func NewClientWithCredsPath ¶
func (*Client) ClaimOneTimeCode ¶
func (*Client) GenerateOneTimeCode ¶
func (c *Client) GenerateOneTimeCode(context models.NatsterContext) (*models.OtcGenerateResponse, error)
func (*Client) GetBoundContextByOAuth ¶
func (c *Client) GetBoundContextByOAuth(oauthId string) (*models.ContextQueryResponse, error)
This is to be called by the natster.io site when someone logs into the site, which will provide an OAuth identifier. If this OAuth ID has been bound to a context, we should be able to download that context and the corresponding credentials
func (*Client) GetMyCatalogs ¶
func (c *Client) GetMyCatalogs() (*[]models.CatalogShareSummary, error)
func (*Client) PublishEvent ¶
func (*Client) PublishHeartbeat ¶
func (c *Client) PublishHeartbeat(nctx *models.NatsterContext, library *medialibrary.MediaLibrary) error
func (*Client) ValidateCatalogName ¶
func (c *Client) ValidateCatalogName(catalog string) (*models.CatalogNameValidationResult, error)
type GlobalService ¶
type GlobalService struct {
// contains filtered or unexported fields
}
func New ¶
func New(nc *nats.Conn) *GlobalService
func (*GlobalService) AllCatalogs ¶
func (srv *GlobalService) AllCatalogs() ([]string, error)
func (*GlobalService) CatalogRevision ¶
func (srv *GlobalService) CatalogRevision(catalog string) int64
func (*GlobalService) CreateKeyValueContext ¶
func (srv *GlobalService) CreateKeyValueContext() (jetstream.KeyValue, error)
func (*GlobalService) GetBoundContext ¶
func (srv *GlobalService) GetBoundContext(myAccountKey string) (*models.ContextBoundEvent, error)
Retrieves the most recent bound context by loading the account projection, if any
func (*GlobalService) GetBoundContextByOAuth ¶
func (srv *GlobalService) GetBoundContextByOAuth(oauthId string) (*models.NatsterContext, error)
TODO: this needs to be converted to use a projection rather than running through the event stream every time
func (*GlobalService) GetCatalog ¶
func (srv *GlobalService) GetCatalog(catalog string) (*catalogProjection, error)
func (*GlobalService) GetMyCatalogs ¶
func (srv *GlobalService) GetMyCatalogs(myAccountKey string) ([]models.CatalogShareSummary, error)
Reads the account projection for the given querying account and returns a flattened list of directional shares to and from this account
func (*GlobalService) GetOAuthIdForAccount ¶
func (srv *GlobalService) GetOAuthIdForAccount(accountKey string) (*string, error)
func (*GlobalService) GetTotalInitializedAccounts ¶
func (srv *GlobalService) GetTotalInitializedAccounts() (uint64, error)
Returns the total number of accounts in which developers have run `natster init`
func (*GlobalService) GetTotalSharedCatalogs ¶
func (srv *GlobalService) GetTotalSharedCatalogs() (uint64, error)
This number is currently inaccurate due to the "unshare" feature. TODO: we can fix this when we add a global stats projection
func (*GlobalService) IsCatalogOnline ¶
func (srv *GlobalService) IsCatalogOnline(catalog string) bool
func (*GlobalService) Start ¶
func (srv *GlobalService) Start(version, commit, date string) error
func (*GlobalService) Stop ¶
func (srv *GlobalService) Stop() error