metasrht

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKind

type AccessKind string
const (
	AccessKindRo AccessKind = "RO"
	AccessKindRw AccessKind = "RW"
)

type AccessScope

type AccessScope string
const (
	AccessScopeAuditLog AccessScope = "AUDIT_LOG"
	AccessScopeBilling  AccessScope = "BILLING"
	AccessScopePgpKeys  AccessScope = "PGP_KEYS"
	AccessScopeSshKeys  AccessScope = "SSH_KEYS"
	AccessScopeProfile  AccessScope = "PROFILE"
)

type AuditLogCursor

type AuditLogCursor struct {
	Results []AuditLogEntry `json:"results"`
	Cursor  *Cursor         `json:"cursor,omitempty"`
}

A cursor for enumerating a list of audit log entries

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func AuditLog

func AuditLog(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (auditLog *AuditLogCursor, err error)

type AuditLogEntry

type AuditLogEntry struct {
	Id        int32          `json:"id"`
	Created   gqlclient.Time `json:"created"`
	IpAddress string         `json:"ipAddress"`
	EventType string         `json:"eventType"`
	Details   *string        `json:"details,omitempty"`
}

type BillingAddress added in v0.7.0

type BillingAddress struct {
	FullName     *string `json:"fullName,omitempty"`
	BusinessName *string `json:"businessName,omitempty"`
	Address1     *string `json:"address1,omitempty"`
	Address2     *string `json:"address2,omitempty"`
	City         *string `json:"city,omitempty"`
	Region       *string `json:"region,omitempty"`
	Postcode     *string `json:"postcode,omitempty"`
	// ISO 3166 two-letter country code
	Country *string `json:"country,omitempty"`
	// Value-added tax number (EU)
	Vat *string `json:"vat,omitempty"`
}

Billing address for invoicing.

type BillingAddressInput added in v0.7.0

type BillingAddressInput struct {
	FullName     *string `json:"fullName,omitempty"`
	BusinessName *string `json:"businessName,omitempty"`
	Address1     *string `json:"address1,omitempty"`
	Address2     *string `json:"address2,omitempty"`
	City         *string `json:"city,omitempty"`
	Region       *string `json:"region,omitempty"`
	Postcode     *string `json:"postcode,omitempty"`
	// ISO 3166 two-letter country code
	Country *string `json:"country,omitempty"`
	// Value-added tax number (EU)
	Vat *string `json:"vat,omitempty"`
}

All fields are optional. If a field is omitted, it is unchanged. If a field is null, it is set to null.

type BillingSubscription added in v0.7.0

type BillingSubscription struct {
	Id      int32              `json:"id"`
	User    *User              `json:"user"`
	Created gqlclient.Time     `json:"created"`
	Updated gqlclient.Time     `json:"updated"`
	Status  SubscriptionStatus `json:"status"`
	// If true, payment is automatically renewed when term ellapses.
	Autorenew bool            `json:"autorenew"`
	Currency  Currency        `json:"currency"`
	Interval  PaymentInterval `json:"interval"`
	// Selected product associated with this subscription.
	Product *Product `json:"product"`
	// Shortcut to get the applicable price point for this subscription's product ID
	// and applicable currency
	Price *ProductPrice `json:"price"`
	// Total price, not including applicable taxes, in the smallest denomination of
	// the currency, e.g. cents USD.
	Subtotal int32 `json:"subtotal"`
}

type Currency added in v0.7.0

type Currency string
const (
	CurrencyEur Currency = "EUR"
	CurrencyUsd Currency = "USD"
)

type Cursor

type Cursor string

type Entity

type Entity struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Updated gqlclient.Time `json:"updated"`
	// The canonical name of this entity. For users, this is their username
	// prefixed with '~'. Additional entity types will be supported in the future.
	CanonicalName string `json:"canonicalName"`

	// Underlying value of the GraphQL interface
	Value EntityValue `json:"-"`
}

func (*Entity) UnmarshalJSON

func (base *Entity) UnmarshalJSON(b []byte) error

type EntityValue

type EntityValue interface {
	// contains filtered or unexported methods
}

EntityValue is one of: User

type Invoice

type Invoice struct {
	Id        int32          `json:"id"`
	InvoiceNo string         `json:"invoiceNo"`
	Issued    gqlclient.Time `json:"issued"`
	Entity    *Entity        `json:"entity"`
	Product   *Product       `json:"product"`
	// Start of service period for which this invoice applies
	ServiceStart gqlclient.Time `json:"serviceStart"`
	// End of service period for which this invoice applies
	ServiceEnd gqlclient.Time `json:"serviceEnd"`
	Currency   Currency       `json:"currency"`
	// Amount charged denoted in the smallest denomination of the applicable
	// currency, e.g. cents USD.
	Total int32 `json:"total"`
}

type InvoiceCursor

type InvoiceCursor struct {
	Results []Invoice `json:"results"`
	Cursor  *Cursor   `json:"cursor,omitempty"`
}

A cursor for enumerating a list of invoices

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type OAuthClient

type OAuthClient struct {
	Id          int32   `json:"id"`
	Uuid        string  `json:"uuid"`
	RedirectUrl string  `json:"redirectUrl"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
	Url         *string `json:"url,omitempty"`
	Owner       *Entity `json:"owner"`
}

type OAuthClientRegistration

type OAuthClientRegistration struct {
	Client *OAuthClient `json:"client"`
	Secret string       `json:"secret"`
}

type OAuthGrant

type OAuthGrant struct {
	Id        int32          `json:"id"`
	Client    *OAuthClient   `json:"client"`
	Issued    gqlclient.Time `json:"issued"`
	Expires   gqlclient.Time `json:"expires"`
	TokenHash string         `json:"tokenHash"`
	Grants    *string        `json:"grants,omitempty"`
}

type OAuthGrantRegistration

type OAuthGrantRegistration struct {
	Grant        *OAuthGrant `json:"grant"`
	Grants       string      `json:"grants"`
	Secret       string      `json:"secret"`
	RefreshToken string      `json:"refreshToken"`
}

type OAuthPersonalToken

type OAuthPersonalToken struct {
	Id      int32          `json:"id"`
	Issued  gqlclient.Time `json:"issued"`
	Expires gqlclient.Time `json:"expires"`
	Comment *string        `json:"comment,omitempty"`
	Grants  *string        `json:"grants,omitempty"`
}

func PersonalAccessTokens

func PersonalAccessTokens(client *gqlclient.Client, ctx context.Context) (personalAccessTokens []OAuthPersonalToken, err error)

type OAuthPersonalTokenRegistration

type OAuthPersonalTokenRegistration struct {
	Token  *OAuthPersonalToken `json:"token"`
	Secret string              `json:"secret"`
}

type PGPKey

type PGPKey struct {
	Id          int32          `json:"id"`
	Created     gqlclient.Time `json:"created"`
	User        *User          `json:"user"`
	Key         string         `json:"key"`
	Fingerprint string         `json:"fingerprint"`
}

func CreatePGPKey

func CreatePGPKey(client *gqlclient.Client, ctx context.Context, key string) (createPGPKey *PGPKey, err error)

func DeletePGPKey

func DeletePGPKey(client *gqlclient.Client, ctx context.Context, id int32) (deletePGPKey *PGPKey, err error)

type PGPKeyCursor

type PGPKeyCursor struct {
	Results []PGPKey `json:"results"`
	Cursor  *Cursor  `json:"cursor,omitempty"`
}

A cursor for enumerating a list of PGP keys

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type PGPKeyEvent

type PGPKeyEvent struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`
	Key   *PGPKey        `json:"key"`
}

type PaymentInterval added in v0.7.0

type PaymentInterval string
const (
	PaymentIntervalMonthly  PaymentInterval = "MONTHLY"
	PaymentIntervalAnnually PaymentInterval = "ANNUALLY"
)

type PaymentStatus added in v0.7.0

type PaymentStatus string
const (
	// User does not pay for their account
	PaymentStatusUnpaid PaymentStatus = "UNPAID"
	// User is paid and their payment is current
	PaymentStatusCurrent PaymentStatus = "CURRENT"
	// User's payment has lapsed
	PaymentStatusDelinquent PaymentStatus = "DELINQUENT"
	// User's paid services are subsidized
	PaymentStatusSubsidized PaymentStatus = "SUBSIDIZED"
	// User receives paid services for free
	PaymentStatusFree PaymentStatus = "FREE"
)

type Product added in v0.7.0

type Product struct {
	Id      int32          `json:"id"`
	Name    string         `json:"name"`
	Prices  []ProductPrice `json:"prices"`
	Retired bool           `json:"retired"`
}

A paid product available for purchase.

type ProductPrice added in v0.7.0

type ProductPrice struct {
	// Applicable currency for this price
	Currency Currency `json:"currency"`
	// Price in the smallest denomination of the currency, e.g. cents USD. Does not
	// include any applicable taxes.
	Amount int32 `json:"amount"`
}

Price point for a product in a given currency.

type ProductPriceInput added in v0.7.0

type ProductPriceInput struct {
	Currency Currency `json:"currency"`
	Amount   int32    `json:"amount"`
}

type ProfileUpdateEvent

type ProfileUpdateEvent struct {
	Uuid    string         `json:"uuid"`
	Event   WebhookEvent   `json:"event"`
	Date    gqlclient.Time `json:"date"`
	Profile *User          `json:"profile"`
}

type ProfileWebhookInput

type ProfileWebhookInput struct {
	Url    string         `json:"url"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
}

type ProfileWebhookSubscription

type ProfileWebhookSubscription struct {
	Id         int32                  `json:"id"`
	Events     []WebhookEvent         `json:"events"`
	Query      string                 `json:"query"`
	Url        string                 `json:"url"`
	Client     *OAuthClient           `json:"client,omitempty"`
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	Sample     string                 `json:"sample"`
}

type SSHKey

type SSHKey struct {
	Id          int32          `json:"id"`
	Created     gqlclient.Time `json:"created"`
	LastUsed    gqlclient.Time `json:"lastUsed,omitempty"`
	User        *User          `json:"user"`
	Key         string         `json:"key"`
	Fingerprint string         `json:"fingerprint"`
	Comment     *string        `json:"comment,omitempty"`
	Username    string         `json:"username"`
}

func CreateSSHKey

func CreateSSHKey(client *gqlclient.Client, ctx context.Context, key string) (createSSHKey *SSHKey, err error)

func DeleteSSHKey

func DeleteSSHKey(client *gqlclient.Client, ctx context.Context, id int32) (deleteSSHKey *SSHKey, err error)

type SSHKeyCursor

type SSHKeyCursor struct {
	Results []SSHKey `json:"results"`
	Cursor  *Cursor  `json:"cursor,omitempty"`
}

A cursor for enumerating a list of SSH keys

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type SSHKeyEvent

type SSHKeyEvent struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`
	Key   *SSHKey        `json:"key"`
}

type SubscriptionStatus added in v0.7.0

type SubscriptionStatus string
const (
	// This subscription is pending and will become active once the first payment is
	// successfully recieved.
	SubscriptionStatusPending SubscriptionStatus = "PENDING"
	// This subscription is paid but the payment has not settled. Paid services are
	// available while awaiting settlement.
	SubscriptionStatusSettlement SubscriptionStatus = "SETTLEMENT"
	// This is the user's active subscription.
	SubscriptionStatusActive SubscriptionStatus = "ACTIVE"
	// This subscription has been cancelled and the service term is complete.
	SubscriptionStatusInactive SubscriptionStatus = "INACTIVE"
)

type User

type User struct {
	Id            int32          `json:"id"`
	Created       gqlclient.Time `json:"created"`
	Updated       gqlclient.Time `json:"updated"`
	CanonicalName string         `json:"canonicalName"`
	Username      string         `json:"username"`
	Email         string         `json:"email"`
	Url           *string        `json:"url,omitempty"`
	Location      *string        `json:"location,omitempty"`
	Bio           *string        `json:"bio,omitempty"`
	SshKeys       *SSHKeyCursor  `json:"sshKeys"`
	PgpKeys       *PGPKeyCursor  `json:"pgpKeys"`
	// User's current payment status. Only available if authenticated as this user.
	PaymentStatus PaymentStatus `json:"paymentStatus"`
	// Date at which next payment is due. Only available if authenticated as this
	// user.
	PaymentDue gqlclient.Time `json:"paymentDue,omitempty"`
	// Details about the user's current paid subscription. Only available if
	// authenticated as this user.
	Subscription *BillingSubscription `json:"subscription,omitempty"`
	// Returns invoices for this user. Only available if authenticated as this user.
	Invoices *InvoiceCursor `json:"invoices"`
	// User's billing address, if applicable, for invoicing.
	BillingAddress *BillingAddress `json:"billingAddress,omitempty"`
	// Internal user type (e.g. is admin)
	UserType UserType `json:"userType"`
	// Returns true if this user should have access to paid services.
	ReceivesPaidServices bool `json:"receivesPaidServices"`
	// Notice to provide to a suspended account
	SuspensionNotice *string `json:"suspensionNotice,omitempty"`
}

func Bio

func Bio(client *gqlclient.Client, ctx context.Context) (me *User, err error)

func ClearBio

func ClearBio(client *gqlclient.Client, ctx context.Context) (updateUser *User, err error)

func ClearUserLocation

func ClearUserLocation(client *gqlclient.Client, ctx context.Context) (updateUser *User, err error)

func ClearUserURL

func ClearUserURL(client *gqlclient.Client, ctx context.Context) (updateUser *User, err error)

func FetchMe

func FetchMe(client *gqlclient.Client, ctx context.Context) (me *User, err error)

func FetchUser

func FetchUser(client *gqlclient.Client, ctx context.Context, username string) (userByName *User, err error)

func ListPGPKeys

func ListPGPKeys(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (me *User, err error)

func ListPGPKeysByUser

func ListPGPKeysByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (userByName *User, err error)

func ListRawPGPKeys

func ListRawPGPKeys(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (me *User, err error)

func ListRawPGPKeysByUser

func ListRawPGPKeysByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (userByName *User, err error)

func ListRawSSHKeys

func ListRawSSHKeys(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (me *User, err error)

func ListRawSSHKeysByUser

func ListRawSSHKeysByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (userByName *User, err error)

func ListSSHKeys

func ListSSHKeys(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (me *User, err error)

func ListSSHKeysByUser

func ListSSHKeysByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (userByName *User, err error)

func UpdateUser

func UpdateUser(client *gqlclient.Client, ctx context.Context, input *UserInput) (updateUser *User, err error)

type UserInput

type UserInput struct {
	Url      *string `json:"url,omitempty"`
	Location *string `json:"location,omitempty"`
	Bio      *string `json:"bio,omitempty"`
	// Note: changing the user's email address will not take effect immediately;
	// the user is sent an email to confirm the change first.
	Email *string `json:"email,omitempty"`
}

Omit these fields to leave them unchanged, or set them to null to clear their value.

type UserType

type UserType string
const (
	UserTypePending   UserType = "PENDING"
	UserTypeUser      UserType = "USER"
	UserTypeAdmin     UserType = "ADMIN"
	UserTypeSuspended UserType = "SUSPENDED"
)

type Version

type Version struct {
	Major int32 `json:"major"`
	Minor int32 `json:"minor"`
	Patch int32 `json:"patch"`
	// If this API version is scheduled for deprecation, this is the date on which
	// it will stop working; or null if this API version is not scheduled for
	// deprecation.
	DeprecationDate gqlclient.Time `json:"deprecationDate,omitempty"`
}

type WebhookDelivery

type WebhookDelivery struct {
	Uuid         string               `json:"uuid"`
	Date         gqlclient.Time       `json:"date"`
	Event        WebhookEvent         `json:"event"`
	Subscription *WebhookSubscription `json:"subscription"`
	RequestBody  string               `json:"requestBody"`
	// These details are provided only after a response is received from the
	// remote server. If a response is sent whose Content-Type is not text/*, or
	// cannot be decoded as UTF-8, the response body will be null. It will be
	// truncated after 64 KiB.
	ResponseBody    *string `json:"responseBody,omitempty"`
	ResponseHeaders *string `json:"responseHeaders,omitempty"`
	ResponseStatus  *int32  `json:"responseStatus,omitempty"`
}

type WebhookDeliveryCursor

type WebhookDeliveryCursor struct {
	Results []WebhookDelivery `json:"results"`
	Cursor  *Cursor           `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook deliveries

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type WebhookEvent

type WebhookEvent string
const (
	// Used for user profile webhooks
	WebhookEventProfileUpdate WebhookEvent = "PROFILE_UPDATE"
	WebhookEventPgpKeyAdded   WebhookEvent = "PGP_KEY_ADDED"
	WebhookEventPgpKeyRemoved WebhookEvent = "PGP_KEY_REMOVED"
	WebhookEventSshKeyAdded   WebhookEvent = "SSH_KEY_ADDED"
	WebhookEventSshKeyRemoved WebhookEvent = "SSH_KEY_REMOVED"
)

func ParseUserEvents

func ParseUserEvents(events []string) ([]WebhookEvent, error)

type WebhookPayload

type WebhookPayload struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`

	// Underlying value of the GraphQL interface
	Value WebhookPayloadValue `json:"-"`
}

func (*WebhookPayload) UnmarshalJSON

func (base *WebhookPayload) UnmarshalJSON(b []byte) error

type WebhookPayloadValue

type WebhookPayloadValue interface {
	// contains filtered or unexported methods
}

WebhookPayloadValue is one of: ProfileUpdateEvent | PGPKeyEvent | SSHKeyEvent

type WebhookSubscription

type WebhookSubscription struct {
	Id     int32          `json:"id"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
	Url    string         `json:"url"`
	// If this webhook was registered by an authorized OAuth 2.0 client, this
	// field is non-null.
	Client *OAuthClient `json:"client,omitempty"`
	// All deliveries which have been sent to this webhook.
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	// Returns a sample payload for this subscription, for testing purposes
	Sample string `json:"sample"`

	// Underlying value of the GraphQL interface
	Value WebhookSubscriptionValue `json:"-"`
}

func CreateUserWebhook

func CreateUserWebhook(client *gqlclient.Client, ctx context.Context, config ProfileWebhookInput) (createWebhook *WebhookSubscription, err error)

func DeleteUserWebhook

func DeleteUserWebhook(client *gqlclient.Client, ctx context.Context, id int32) (deleteWebhook *WebhookSubscription, err error)

func (*WebhookSubscription) UnmarshalJSON

func (base *WebhookSubscription) UnmarshalJSON(b []byte) error

type WebhookSubscriptionCursor

type WebhookSubscriptionCursor struct {
	Results []WebhookSubscription `json:"results"`
	Cursor  *Cursor               `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook subscriptions

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func UserWebhooks

func UserWebhooks(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (profileWebhooks *WebhookSubscriptionCursor, err error)

type WebhookSubscriptionValue

type WebhookSubscriptionValue interface {
	// contains filtered or unexported methods
}

WebhookSubscriptionValue is one of: ProfileWebhookSubscription

Jump to

Keyboard shortcuts

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