Documentation ¶
Index ¶
- Constants
- Variables
- type ApiToken
- type ApiTokensClient
- type BillingAddress
- type BillingClient
- func (c *BillingClient) CreateStripeCustomer(ctx context.Context, name string) (string, error)
- func (c *BillingClient) GetBillingCustomer(ctx context.Context) (BillingCustomer, error)
- func (c *BillingClient) HasPaymentMethod(ctx context.Context) (bool, error)
- func (c *BillingClient) HasPaymentMethodWithStripeId(ctx context.Context, stripeId string) (bool, error)
- func (c *BillingClient) Portal(ctx context.Context) (Portal, error)
- func (c *BillingClient) PortalForStripeId(ctx context.Context, stripeId string) (Portal, error)
- func (c *BillingClient) UpdateBillingCustomer(ctx context.Context, customer BillingCustomer) error
- type BillingCustomer
- type Body
- type Client
- func (c *Client) Delete(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Do(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, urlPath string, body io.Reader) (*http.Request, error)
- func (c *Client) Patch(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (c *Client) Upload(ctx context.Context, path string, fileData *os.File) (*http.Response, error)
- type ClientOption
- type ClosestLocationResponse
- type CreateApiToken
- type CreateDatabaseBody
- type CreateDatabaseResponse
- type CreateInstanceLocationError
- type DBSeed
- type Database
- type DatabaseConfig
- type DatabaseTokenRequest
- type DatabasesClient
- func (c *DatabasesClient) Create(ctx context.Context, name, location, image, extensions, group string, ...) (*CreateDatabaseResponse, error)
- func (c *DatabasesClient) Delete(ctx context.Context, database string) error
- func (c *DatabasesClient) GetConfig(ctx context.Context, database string) (DatabaseConfig, error)
- func (c *DatabasesClient) List(ctx context.Context) ([]Database, error)
- func (c *DatabasesClient) Rotate(ctx context.Context, database string) error
- func (c *DatabasesClient) Seed(ctx context.Context, name string, dbFile *os.File) error
- func (c *DatabasesClient) Stats(ctx context.Context, database string) (Stats, error)
- func (c *DatabasesClient) Token(ctx context.Context, database string, expiration string, readOnly bool, ...) (string, error)
- func (c *DatabasesClient) Transfer(ctx context.Context, database, org string) error
- func (c *DatabasesClient) URL(suffix string) string
- func (c *DatabasesClient) Update(ctx context.Context, database string, group bool) error
- func (c *DatabasesClient) UpdateConfig(ctx context.Context, database string, config DatabaseConfig) error
- func (c *DatabasesClient) UploadDump(ctx context.Context, dbFile *os.File) (string, error)
- func (c *DatabasesClient) Usage(ctx context.Context, database string) (DbUsage, error)
- func (c *DatabasesClient) Wakeup(ctx context.Context, database string) error
- type DbUsage
- type DbUsageResponse
- type Entities
- type FeedbackClient
- type Group
- type GroupTokenRequest
- type GroupsClient
- func (g *GroupsClient) AddLocation(ctx context.Context, name, location string) error
- func (g *GroupsClient) Create(ctx context.Context, name, location, version string) error
- func (g *GroupsClient) Delete(ctx context.Context, group string) error
- func (g *GroupsClient) Get(ctx context.Context, name string) (Group, error)
- func (g *GroupsClient) List(ctx context.Context) ([]Group, error)
- func (g *GroupsClient) RemoveLocation(ctx context.Context, name, location string) error
- func (g *GroupsClient) Rotate(ctx context.Context, group string) error
- func (g *GroupsClient) Token(ctx context.Context, group string, expiration string, readOnly bool, ...) (string, error)
- func (g *GroupsClient) Transfer(ctx context.Context, group string, to string) error
- func (g *GroupsClient) URL(suffix string) string
- func (g *GroupsClient) Unarchive(ctx context.Context, name string) error
- func (g *GroupsClient) Update(ctx context.Context, group string, version, extensions string) error
- func (g *GroupsClient) WaitLocation(ctx context.Context, name, location string) error
- type Instance
- type InstanceUsage
- type InstancesClient
- func (c *InstancesClient) Create(ctx context.Context, dbName, location string) (*Instance, error)
- func (c *InstancesClient) Delete(ctx context.Context, db, instance string) error
- func (c *InstancesClient) List(ctx context.Context, db string) ([]Instance, error)
- func (d *InstancesClient) URL(database, suffix string) string
- func (c *InstancesClient) Wait(ctx context.Context, db, instance string) error
- type Invite
- type Invoice
- type InvoicesClient
- type Location
- type LocationResponse
- type LocationsClient
- type LocationsResponse
- type Member
- type OrgTotal
- type OrgUsage
- type OrgUsageResponse
- type Organization
- type OrganizationsClient
- func (c *OrganizationsClient) AddMember(ctx context.Context, username, role string) error
- func (c *OrganizationsClient) Create(ctx context.Context, name string, stripeId string, dryRun bool) (Organization, error)
- func (c *OrganizationsClient) Delete(ctx context.Context, slug string) error
- func (c *OrganizationsClient) DeleteInvite(ctx context.Context, email string) error
- func (c *OrganizationsClient) InviteMember(ctx context.Context, email, role string) error
- func (c *OrganizationsClient) List(ctx context.Context) ([]Organization, error)
- func (c *OrganizationsClient) ListInvites(ctx context.Context) ([]Invite, error)
- func (c *OrganizationsClient) ListMembers(ctx context.Context) ([]Member, error)
- func (c *OrganizationsClient) MembersURL(suffix string) (string, error)
- func (c *OrganizationsClient) RemoveMember(ctx context.Context, username string) error
- func (c *OrganizationsClient) SetOverages(ctx context.Context, slug string, toggle bool) error
- func (c *OrganizationsClient) Usage(ctx context.Context) (OrgUsage, error)
- type PermissionsClaim
- type Plan
- type PlansClient
- type Portal
- type Stats
- type Subscription
- type SubscriptionClient
- type TaxID
- type TokensClient
- type Usage
- type UserInfo
- type UserInfoResponse
- type UsersClient
Constants ¶
View Source
const BaseURL = "https://api.turso.tech"
Variables ¶
View Source
var ( ErrMissingBaseURL = errors.New("no baseUrl set") ErrMissingAPIToken = errors.New("no API token set") ErrMissingHTTPClient = errors.New("no httpClient set") )
View Source
var ErrPaymentRequired = errors.New("payment required")
Functions ¶
This section is empty.
Types ¶
type ApiTokensClient ¶
type ApiTokensClient client
func (*ApiTokensClient) Create ¶
func (c *ApiTokensClient) Create(ctx context.Context, name string) (CreateApiToken, error)
type BillingAddress ¶
type BillingClient ¶
type BillingClient client
func (*BillingClient) CreateStripeCustomer ¶
func (*BillingClient) GetBillingCustomer ¶
func (c *BillingClient) GetBillingCustomer(ctx context.Context) (BillingCustomer, error)
func (*BillingClient) HasPaymentMethod ¶
func (c *BillingClient) HasPaymentMethod(ctx context.Context) (bool, error)
func (*BillingClient) HasPaymentMethodWithStripeId ¶
func (*BillingClient) PortalForStripeId ¶
func (*BillingClient) UpdateBillingCustomer ¶
func (c *BillingClient) UpdateBillingCustomer(ctx context.Context, customer BillingCustomer) error
type BillingCustomer ¶
type BillingCustomer struct { Name string `json:"name"` Email string `json:"email"` TaxID TaxID `json:"tax_id"` BillingAddress BillingAddress `json:"billing_address"` }
type Client ¶
type Client struct { Org string Instances *InstancesClient Databases *DatabasesClient Feedback *FeedbackClient Organizations *OrganizationsClient ApiTokens *ApiTokensClient Locations *LocationsClient Tokens *TokensClient Users *UsersClient Plans *PlansClient Subscriptions *SubscriptionClient Billing *BillingClient Groups *GroupsClient Invoices *InvoicesClient // contains filtered or unexported fields }
Collection of all turso clients
func (*Client) NewRequest ¶
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
func WithBaseUrl ¶
func WithBaseUrl(baseUrl string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
type ClosestLocationResponse ¶
type ClosestLocationResponse struct {
Server string
}
type CreateApiToken ¶
type CreateDatabaseBody ¶
type CreateDatabaseBody struct { Name string `json:"name"` Location string `json:"location"` Image string `json:"image,omitempty"` Extensions string `json:"extensions,omitempty"` Group string `json:"group,omitempty"` Seed *DBSeed `json:"seed,omitempty"` Schema string `json:"schema,omitempty"` IsSchema bool `json:"is_schema,omitempty"` }
type CreateDatabaseResponse ¶
type CreateInstanceLocationError ¶
type CreateInstanceLocationError struct {
// contains filtered or unexported fields
}
func (*CreateInstanceLocationError) Error ¶
func (e *CreateInstanceLocationError) Error() string
type DatabaseConfig ¶
type DatabaseConfig struct {
AllowAttach bool `json:"allow_attach"`
}
type DatabaseTokenRequest ¶
type DatabaseTokenRequest struct {
Permissions *PermissionsClaim `json:"permissions,omitempty"`
}
type DatabasesClient ¶
type DatabasesClient client
func (*DatabasesClient) Create ¶
func (c *DatabasesClient) Create(ctx context.Context, name, location, image, extensions, group string, schema string, isSchema bool, seed *DBSeed) (*CreateDatabaseResponse, error)
func (*DatabasesClient) Delete ¶
func (c *DatabasesClient) Delete(ctx context.Context, database string) error
func (*DatabasesClient) GetConfig ¶
func (c *DatabasesClient) GetConfig(ctx context.Context, database string) (DatabaseConfig, error)
func (*DatabasesClient) List ¶
func (c *DatabasesClient) List(ctx context.Context) ([]Database, error)
func (*DatabasesClient) Rotate ¶
func (c *DatabasesClient) Rotate(ctx context.Context, database string) error
func (*DatabasesClient) Token ¶
func (c *DatabasesClient) Token(ctx context.Context, database string, expiration string, readOnly bool, permissions *PermissionsClaim) (string, error)
func (*DatabasesClient) Transfer ¶
func (c *DatabasesClient) Transfer(ctx context.Context, database, org string) error
func (*DatabasesClient) URL ¶
func (c *DatabasesClient) URL(suffix string) string
func (*DatabasesClient) UpdateConfig ¶
func (c *DatabasesClient) UpdateConfig(ctx context.Context, database string, config DatabaseConfig) error
func (*DatabasesClient) UploadDump ¶
type DbUsage ¶
type DbUsage struct { UUID string `json:"uuid,omitempty"` Instances []InstanceUsage `json:"instances"` Usage Usage `json:"usage"` }
type DbUsageResponse ¶
type DbUsageResponse struct {
DbUsage DbUsage `json:"database"`
}
type FeedbackClient ¶
type FeedbackClient client
type GroupTokenRequest ¶
type GroupTokenRequest struct {
Permissions *PermissionsClaim `json:"permissions,omitempty"`
}
type GroupsClient ¶
type GroupsClient client
func (*GroupsClient) AddLocation ¶
func (g *GroupsClient) AddLocation(ctx context.Context, name, location string) error
func (*GroupsClient) Create ¶
func (g *GroupsClient) Create(ctx context.Context, name, location, version string) error
func (*GroupsClient) Delete ¶
func (g *GroupsClient) Delete(ctx context.Context, group string) error
func (*GroupsClient) RemoveLocation ¶
func (g *GroupsClient) RemoveLocation(ctx context.Context, name, location string) error
func (*GroupsClient) Rotate ¶
func (g *GroupsClient) Rotate(ctx context.Context, group string) error
func (*GroupsClient) Token ¶
func (g *GroupsClient) Token(ctx context.Context, group string, expiration string, readOnly bool, permissions *PermissionsClaim) (string, error)
func (*GroupsClient) URL ¶
func (g *GroupsClient) URL(suffix string) string
func (*GroupsClient) Unarchive ¶
func (g *GroupsClient) Unarchive(ctx context.Context, name string) error
func (*GroupsClient) WaitLocation ¶
func (g *GroupsClient) WaitLocation(ctx context.Context, name, location string) error
type InstanceUsage ¶
type InstancesClient ¶
type InstancesClient client
func (*InstancesClient) Delete ¶
func (c *InstancesClient) Delete(ctx context.Context, db, instance string) error
func (*InstancesClient) URL ¶
func (d *InstancesClient) URL(database, suffix string) string
type InvoicesClient ¶
type InvoicesClient client
func (*InvoicesClient) URL ¶
func (c *InvoicesClient) URL(suffix string) string
type LocationResponse ¶
type LocationsClient ¶
type LocationsClient client
func (*LocationsClient) Closest ¶
func (c *LocationsClient) Closest(ctx context.Context) (string, error)
func (*LocationsClient) Get ¶
func (c *LocationsClient) Get(ctx context.Context, location string) (LocationResponse, error)
type LocationsResponse ¶
type OrgTotal ¶
type OrgTotal struct { RowsRead uint64 `json:"rows_read,omitempty"` RowsWritten uint64 `json:"rows_written,omitempty"` StorageBytesUsed uint64 `json:"storage_bytes,omitempty"` BytesSynced uint64 `json:"bytes_synced,omitempty"` Databases uint64 `json:"databases,omitempty"` Locations uint64 `json:"locations,omitempty"` Groups uint64 `json:"groups,omitempty"` }
type OrgUsageResponse ¶
type OrgUsageResponse struct {
OrgUsage OrgUsage `json:"organization"`
}
type Organization ¶
type OrganizationsClient ¶
type OrganizationsClient client
func (*OrganizationsClient) AddMember ¶
func (c *OrganizationsClient) AddMember(ctx context.Context, username, role string) error
func (*OrganizationsClient) Create ¶
func (c *OrganizationsClient) Create(ctx context.Context, name string, stripeId string, dryRun bool) (Organization, error)
func (*OrganizationsClient) Delete ¶
func (c *OrganizationsClient) Delete(ctx context.Context, slug string) error
func (*OrganizationsClient) DeleteInvite ¶
func (c *OrganizationsClient) DeleteInvite(ctx context.Context, email string) error
func (*OrganizationsClient) InviteMember ¶
func (c *OrganizationsClient) InviteMember(ctx context.Context, email, role string) error
func (*OrganizationsClient) List ¶
func (c *OrganizationsClient) List(ctx context.Context) ([]Organization, error)
func (*OrganizationsClient) ListInvites ¶
func (c *OrganizationsClient) ListInvites(ctx context.Context) ([]Invite, error)
func (*OrganizationsClient) ListMembers ¶
func (c *OrganizationsClient) ListMembers(ctx context.Context) ([]Member, error)
func (*OrganizationsClient) MembersURL ¶
func (c *OrganizationsClient) MembersURL(suffix string) (string, error)
func (*OrganizationsClient) RemoveMember ¶
func (c *OrganizationsClient) RemoveMember(ctx context.Context, username string) error
func (*OrganizationsClient) SetOverages ¶
type PermissionsClaim ¶
type PermissionsClaim struct {
ReadAttach Entities `json:"read_attach,omitempty"`
}
type Plan ¶
type Plan struct { Name string `json:"name"` Price string `json:"price"` Quotas struct { RowsRead uint64 `json:"rowsRead"` RowsWritten uint64 `json:"rowsWritten"` Databases uint64 `json:"databases"` BytesSynced uint64 `json:"bytesSynced"` Locations uint64 `json:"locations"` Storage uint64 `json:"storage"` Groups uint64 `json:"groups"` } }
type PlansClient ¶
type PlansClient client
type Subscription ¶
type SubscriptionClient ¶
type SubscriptionClient client
func (*SubscriptionClient) Get ¶
func (c *SubscriptionClient) Get(ctx context.Context) (Subscription, error)
type TokensClient ¶
type TokensClient client
func (*TokensClient) Invalidate ¶
func (c *TokensClient) Invalidate(ctx context.Context) (int64, error)
type UserInfoResponse ¶
type UserInfoResponse struct {
User UserInfo `json:"user"`
}
type UsersClient ¶
type UsersClient client
Click to show internal directories.
Click to hide internal directories.