Documentation ¶
Index ¶
- Constants
- type APIError
- type Client
- type ElementsClient
- func (client *ElementsClient) CreatePaste(namespaceID string, data *schema.CreatePasteElementData) (*schema.Element, error)
- func (client *ElementsClient) CreateRedirect(namespaceID string, data *schema.CreateRedirectElementData) (*schema.Element, error)
- func (client *ElementsClient) Delete(namespaceID, key string) error
- func (client *ElementsClient) GetList(limit, skip int) (*schema.Elements, error)
- func (client *ElementsClient) GetListInNamespace(namespaceID string, limit, skip int) (*schema.Elements, error)
- func (client *ElementsClient) Patch(namespaceID, key string, data *schema.PatchElementData) (*schema.Element, error)
- type InstanceClient
- type InvitesClient
- func (client *InvitesClient) Create(data *schema.CreateInviteData) (*schema.Invite, error)
- func (client *InvitesClient) Delete(code string) error
- func (client *InvitesClient) GetList(limit, skip int) (*schema.Invites, error)
- func (client *InvitesClient) GetSingle(code string) (*schema.Invite, error)
- func (client *InvitesClient) Patch(code string, data *schema.PatchInviteData) (*schema.Invite, error)
- type NamespacesClient
- func (client *NamespacesClient) Create(data *schema.CreateNamespaceData) (*schema.Namespace, error)
- func (client *NamespacesClient) Delete(id string) error
- func (client *NamespacesClient) GetList(limit, skip int) (*schema.Namespaces, error)
- func (client *NamespacesClient) GetSingle(id string) (*schema.Namespace, error)
- func (client *NamespacesClient) Patch(id string, data *schema.PatchNamespaceData) (*schema.Namespace, error)
- func (client *NamespacesClient) ResetToken(id string) (*schema.Namespace, error)
Constants ¶
const ( ErrorCodeGenericUnexpectedError = 1000 ErrorCodeGenericBadQueryParameter = 1002 ErrorCodeGenericBadRequestBody = 1003 ErrorCodeGenericNamespaceNotFound = 1004 ErrorCodeGenericElementNotFound = 1005 ErrorCodeGenericInviteNotFound = 1006 ErrorCodeNamespaceIllegalNamespaceID = 2000 ErrorCodeNamespaceNamespaceIDInUse = 2001 ErrorCodeNamespaceInvalidInviteCode = 2002 ErrorCodeElementElementKeyInUse = 3000 ErrorCodeElementNamespaceDeactivated = 3001 ErrorCodeElementPasteEmptyPasteContent = 3100 ErrorCodeElementRedirectInvalidTargetURL = 3200 ErrorCodeInviteInvitesDisabled = 4000 ErrorCodeInviteInviteCodeInUse = 4001 )
const ( PublicInstance = "https://api.x0.tf" PublicStagingInstance = "https://api.s.x0.tf" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code int `json:"code"` Message string `json:"message"` Data map[string]interface{} `json:"data"` }
APIError represents a x0-specific error structure returned from the x0 API
type Client ¶
type Client struct { Instance *InstanceClient Namespaces *NamespacesClient Elements *ElementsClient Invites *InvitesClient }
Client represents the entrypoint to use the x0 API client
func NewClientWithToken ¶
NewClientWithToken creates a new x0 API client with an auth token set
type ElementsClient ¶
type ElementsClient struct {
// contains filtered or unexported fields
}
ElementsClient is used to execute API requests directed to the element-related scopes
func (*ElementsClient) CreatePaste ¶
func (client *ElementsClient) CreatePaste(namespaceID string, data *schema.CreatePasteElementData) (*schema.Element, error)
CreatePaste creates a new paste element
func (*ElementsClient) CreateRedirect ¶
func (client *ElementsClient) CreateRedirect(namespaceID string, data *schema.CreateRedirectElementData) (*schema.Element, error)
CreateRedirect creates a new redirect element
func (*ElementsClient) Delete ¶
func (client *ElementsClient) Delete(namespaceID, key string) error
Delete deletes an existing element
func (*ElementsClient) GetList ¶
func (client *ElementsClient) GetList(limit, skip int) (*schema.Elements, error)
GetList requests a paginated list of existent elements
func (*ElementsClient) GetListInNamespace ¶
func (client *ElementsClient) GetListInNamespace(namespaceID string, limit, skip int) (*schema.Elements, error)
GetListInNamespace requests a paginated list of existent elements in a specific namespace
func (*ElementsClient) Patch ¶
func (client *ElementsClient) Patch(namespaceID, key string, data *schema.PatchElementData) (*schema.Element, error)
Patch patches an existing element
type InstanceClient ¶
type InstanceClient struct {
// contains filtered or unexported fields
}
InstanceClient is used to execute API requests directed to the general instance
func (*InstanceClient) GetInfo ¶
func (client *InstanceClient) GetInfo() (*schema.InstanceInfo, error)
GetInfo requests the instance information for the specified x0 instance
type InvitesClient ¶
type InvitesClient struct {
// contains filtered or unexported fields
}
InvitesClient is used to execute API requests directed to the invite-related scopes
func (*InvitesClient) Create ¶
func (client *InvitesClient) Create(data *schema.CreateInviteData) (*schema.Invite, error)
Create creates a new invite
func (*InvitesClient) Delete ¶
func (client *InvitesClient) Delete(code string) error
Delete deletes an existing invite
func (*InvitesClient) GetList ¶
func (client *InvitesClient) GetList(limit, skip int) (*schema.Invites, error)
GetList requests a paginated list of existent invites
func (*InvitesClient) GetSingle ¶
func (client *InvitesClient) GetSingle(code string) (*schema.Invite, error)
GetSingle requests a single invite
func (*InvitesClient) Patch ¶
func (client *InvitesClient) Patch(code string, data *schema.PatchInviteData) (*schema.Invite, error)
Patch patches an existing invite
type NamespacesClient ¶
type NamespacesClient struct {
// contains filtered or unexported fields
}
NamespacesClient is used to execute API requests directed to the namespace-related scopes
func (*NamespacesClient) Create ¶
func (client *NamespacesClient) Create(data *schema.CreateNamespaceData) (*schema.Namespace, error)
Create creates a new namespace
func (*NamespacesClient) Delete ¶
func (client *NamespacesClient) Delete(id string) error
Delete deletes an existing namespace
func (*NamespacesClient) GetList ¶
func (client *NamespacesClient) GetList(limit, skip int) (*schema.Namespaces, error)
GetList requests a paginated list of existent namespaces
func (*NamespacesClient) GetSingle ¶
func (client *NamespacesClient) GetSingle(id string) (*schema.Namespace, error)
GetSingle requests a single namespace
func (*NamespacesClient) Patch ¶
func (client *NamespacesClient) Patch(id string, data *schema.PatchNamespaceData) (*schema.Namespace, error)
Patch patches an existing namespace
func (*NamespacesClient) ResetToken ¶
func (client *NamespacesClient) ResetToken(id string) (*schema.Namespace, error)
ResetToken resets the token of an existing namespace