Documentation
¶
Overview ¶
Package administrate provides a Go client for the administrate.dev API.
Usage ¶
client, err := administrate.NewClient("sk_live_...")
if err != nil {
log.Fatal(err)
}
// Get current account info
me, err := client.Account.Me(ctx)
// List users with auto-pagination
iter := client.Users.List(ctx, nil)
for iter.Next() {
fmt.Println(iter.Value().Email)
}
if err := iter.Err(); err != nil {
log.Fatal(err)
}
// Create a company
company, err := client.Companies.Create(ctx, administrate.CompanyCreateParams{
Name: "Acme Corp",
})
All network methods accept a context.Context as their first parameter. List methods return an Iterator that handles pagination automatically.
Use pointer helpers (String, Int, Bool, Float64) to set optional fields:
client.Companies.Update(ctx, id, administrate.CompanyUpdateParams{
Name: administrate.String("New Name"),
Notes: administrate.String("Updated notes"),
})
Index ¶
- func Bool(v bool) *bool
- func Float64(v float64) *float64
- func Int(v int) *int
- func String(v string) *string
- type APIError
- type APITokenCreateParams
- type APITokenListParams
- type APITokenService
- func (s *APITokenService) Create(ctx context.Context, params APITokenCreateParams) (*ApiToken, error)
- func (s *APITokenService) Delete(ctx context.Context, id string) error
- func (s *APITokenService) Get(ctx context.Context, id string) (*ApiToken, error)
- func (s *APITokenService) List(ctx context.Context, params *APITokenListParams) *Iterator[ApiToken]
- func (s *APITokenService) Update(ctx context.Context, id string, params APITokenUpdateParams) (*ApiToken, error)
- type APITokenUpdateParams
- type Account
- type AccountInfo
- type AccountService
- type AccountUpdateParams
- type ApiToken
- type ApiTokenCreatedBy
- type AuthenticationError
- type Client
- type Company
- type CompanyCreateParams
- type CompanyListParams
- type CompanyMetrics
- type CompanyService
- func (s *CompanyService) Create(ctx context.Context, params CompanyCreateParams) (*Company, error)
- func (s *CompanyService) Delete(ctx context.Context, id string) error
- func (s *CompanyService) Get(ctx context.Context, id string) (*Company, error)
- func (s *CompanyService) List(ctx context.Context, params *CompanyListParams) *Iterator[Company]
- func (s *CompanyService) Update(ctx context.Context, id string, params CompanyUpdateParams) (*Company, error)
- type CompanyUpdateParams
- type ConnectionError
- type Execution
- type ExecutionListParams
- type ExecutionService
- type Instance
- type InstanceCreateParams
- type InstanceListParams
- type InstanceMetrics
- type InstanceService
- func (s *InstanceService) Create(ctx context.Context, params InstanceCreateParams) (*Instance, error)
- func (s *InstanceService) Delete(ctx context.Context, id string) error
- func (s *InstanceService) Get(ctx context.Context, id string) (*Instance, error)
- func (s *InstanceService) List(ctx context.Context, params *InstanceListParams) *Iterator[Instance]
- func (s *InstanceService) Sync(ctx context.Context, id string, params *InstanceSyncParams) (map[string]any, error)
- func (s *InstanceService) SyncAll(ctx context.Context, params *InstanceSyncAllParams) (map[string]any, error)
- func (s *InstanceService) Update(ctx context.Context, id string, params InstanceUpdateParams) (*Instance, error)
- type InstanceSyncAllParams
- type InstanceSyncParams
- type InstanceUpdateParams
- type InternalServerError
- type Invitation
- type Iterator
- type LLMCostByClient
- type LLMCostByClientResponse
- type LLMCostByProviderResponse
- type LLMCostDaily
- type LLMCostData
- type LLMCostMeta
- type LLMCostModel
- type LLMCostParams
- type LLMCostProvider
- type LLMCostService
- func (s *LLMCostService) ByClient(ctx context.Context, params *LLMCostParams) (*LLMCostByClientResponse, error)
- func (s *LLMCostService) ByProvider(ctx context.Context, params *LLMCostParams) (*LLMCostByProviderResponse, error)
- func (s *LLMCostService) Summary(ctx context.Context, params *LLMCostParams) (*LLMCostSummaryResponse, error)
- type LLMCostSummary
- type LLMCostSummaryResponse
- type LLMProject
- type LLMProjectListParams
- type LLMProjectService
- type LLMProjectUpdateParams
- type LLMProvider
- type LLMProviderCreateParams
- type LLMProviderListParams
- type LLMProviderMetrics
- type LLMProviderService
- func (s *LLMProviderService) Create(ctx context.Context, params LLMProviderCreateParams) (*LLMProvider, error)
- func (s *LLMProviderService) Delete(ctx context.Context, id string) error
- func (s *LLMProviderService) Get(ctx context.Context, id string) (*LLMProvider, error)
- func (s *LLMProviderService) List(ctx context.Context, params *LLMProviderListParams) *Iterator[LLMProvider]
- func (s *LLMProviderService) Sync(ctx context.Context, id string) (map[string]any, error)
- func (s *LLMProviderService) Update(ctx context.Context, id string, params LLMProviderUpdateParams) (*LLMProvider, error)
- type LLMProviderUpdateParams
- type ListParams
- type MeResponse
- type NotFoundError
- type Option
- type PaginationMeta
- type PermissionDeniedError
- type RateLimitError
- type SyncHealthEntry
- type SyncHealthSyncInfo
- type SyncRun
- type SyncRunListParams
- type SyncRunService
- type TimeoutError
- type TokenInfo
- type User
- type UserInviteParams
- type UserListParams
- type UserService
- func (s *UserService) Delete(ctx context.Context, id string) error
- func (s *UserService) Get(ctx context.Context, id string) (*User, error)
- func (s *UserService) Invite(ctx context.Context, params UserInviteParams) (*Invitation, error)
- func (s *UserService) List(ctx context.Context, params *UserListParams) *Iterator[User]
- func (s *UserService) Update(ctx context.Context, id string, params UserUpdateParams) (*User, error)
- type UserUpdateParams
- type ValidationError
- type Webhook
- type WebhookCreateParams
- type WebhookListParams
- type WebhookService
- func (s *WebhookService) Create(ctx context.Context, params WebhookCreateParams) (*Webhook, error)
- func (s *WebhookService) Delete(ctx context.Context, id string) error
- func (s *WebhookService) Get(ctx context.Context, id string) (*Webhook, error)
- func (s *WebhookService) List(ctx context.Context, params *WebhookListParams) *Iterator[Webhook]
- func (s *WebhookService) RegenerateSecret(ctx context.Context, id string) (*Webhook, error)
- func (s *WebhookService) Update(ctx context.Context, id string, params WebhookUpdateParams) (*Webhook, error)
- type WebhookUpdateParams
- type Workflow
- type WorkflowListParams
- type WorkflowMetrics
- type WorkflowService
- type WorkflowUpdateParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APITokenCreateParams ¶
type APITokenCreateParams struct {
Name string `json:"name"`
Permission *string `json:"permission,omitempty"`
IPAllowlist []string `json:"ip_allowlist,omitempty"`
ExpiresIn *string `json:"expires_in,omitempty"`
}
APITokenCreateParams are parameters for APITokenService.Create.
type APITokenListParams ¶
type APITokenListParams struct {
ListParams
}
APITokenListParams are parameters for APITokenService.List.
type APITokenService ¶
type APITokenService struct {
// contains filtered or unexported fields
}
APITokenService provides access to API token endpoints.
func (*APITokenService) Create ¶
func (s *APITokenService) Create(ctx context.Context, params APITokenCreateParams) (*ApiToken, error)
Create creates a new API token.
func (*APITokenService) Delete ¶
func (s *APITokenService) Delete(ctx context.Context, id string) error
Delete revokes an API token by ID.
func (*APITokenService) List ¶
func (s *APITokenService) List(ctx context.Context, params *APITokenListParams) *Iterator[ApiToken]
List returns an iterator over all API tokens.
func (*APITokenService) Update ¶
func (s *APITokenService) Update(ctx context.Context, id string, params APITokenUpdateParams) (*ApiToken, error)
Update modifies an API token by ID.
type APITokenUpdateParams ¶
type APITokenUpdateParams struct {
Name *string `json:"name,omitempty"`
IPAllowlist []string `json:"ip_allowlist,omitempty"`
}
APITokenUpdateParams are parameters for APITokenService.Update.
type Account ¶
type Account struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
BillingEmail *string `json:"billing_email"`
Phone *string `json:"phone"`
Timezone *string `json:"timezone"`
LogoURL *string `json:"logo_url"`
Plan string `json:"plan"`
PlanName string `json:"plan_name"`
OnTrial bool `json:"on_trial"`
TrialEndsAt *string `json:"trial_ends_at"`
Usage any `json:"usage"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Account represents an administrate.dev account.
type AccountInfo ¶
type AccountInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Plan string `json:"plan"`
}
AccountInfo contains summary account information returned by AccountService.Me.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService provides access to account-related API endpoints.
func (*AccountService) Get ¶
func (s *AccountService) Get(ctx context.Context) (*Account, error)
Get returns the current account details.
func (*AccountService) Me ¶
func (s *AccountService) Me(ctx context.Context) (*MeResponse, error)
Me returns information about the current API token and account. This endpoint does not use the standard data envelope.
func (*AccountService) Update ¶
func (s *AccountService) Update(ctx context.Context, params AccountUpdateParams) (*Account, error)
Update modifies the current account.
type AccountUpdateParams ¶
type AccountUpdateParams struct {
Name *string `json:"name,omitempty"`
BillingEmail *string `json:"billing_email,omitempty"`
Timezone *string `json:"timezone,omitempty"`
}
AccountUpdateParams are parameters for AccountService.Update.
type ApiToken ¶
type ApiToken struct {
ID string `json:"id"`
Name string `json:"name"`
Permission string `json:"permission"`
PermissionLabel string `json:"permission_label"`
TokenHint string `json:"token_hint"`
IPAllowlist []string `json:"ip_allowlist"`
LastUsedAt *string `json:"last_used_at"`
ExpiresAt *string `json:"expires_at"`
Revoked bool `json:"revoked"`
Active bool `json:"active"`
CreatedBy ApiTokenCreatedBy `json:"created_by"`
Token *string `json:"token"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
ApiToken represents an API token.
type ApiTokenCreatedBy ¶
ApiTokenCreatedBy identifies the user who created an API token.
type AuthenticationError ¶
type AuthenticationError struct {
APIError
}
AuthenticationError is returned when the API key is invalid (HTTP 401).
type Client ¶
type Client struct {
Account *AccountService
Users *UserService
Webhooks *WebhookService
APITokens *APITokenService
Companies *CompanyService
Instances *InstanceService
Workflows *WorkflowService
Executions *ExecutionService
SyncRuns *SyncRunService
LLMProviders *LLMProviderService
LLMProjects *LLMProjectService
LLMCosts *LLMCostService
// contains filtered or unexported fields
}
Client is the entry point for the administrate.dev API.
type Company ¶
type Company struct {
ID string `json:"id"`
Name string `json:"name"`
Code *string `json:"code"`
Notes *string `json:"notes"`
Timezone *string `json:"timezone"`
EffectiveTimezone *string `json:"effective_timezone"`
ContactFirstName *string `json:"contact_first_name"`
ContactLastName *string `json:"contact_last_name"`
ContactEmail *string `json:"contact_email"`
ContactPhone *string `json:"contact_phone"`
N8NInstancesCount int `json:"n8n_instances_count"`
Metrics *CompanyMetrics `json:"metrics"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Company represents a client (company) in administrate.dev. The API uses "clients" as the resource path and "company_id" internally.
type CompanyCreateParams ¶
type CompanyCreateParams struct {
Name string `json:"name"`
Code *string `json:"code,omitempty"`
Notes *string `json:"notes,omitempty"`
Timezone *string `json:"timezone,omitempty"`
ContactFirstName *string `json:"contact_first_name,omitempty"`
ContactLastName *string `json:"contact_last_name,omitempty"`
ContactEmail *string `json:"contact_email,omitempty"`
ContactPhone *string `json:"contact_phone,omitempty"`
}
CompanyCreateParams are parameters for CompanyService.Create.
type CompanyListParams ¶
type CompanyListParams struct {
ListParams
}
CompanyListParams are parameters for CompanyService.List.
type CompanyMetrics ¶
type CompanyMetrics struct {
ExecutionsCount int `json:"executions_count"`
SuccessRate *float64 `json:"success_rate"`
FailureCount int `json:"failure_count"`
TimeSavedMinutes *float64 `json:"time_saved_minutes"`
}
CompanyMetrics contains aggregate metrics for a company.
type CompanyService ¶
type CompanyService struct {
// contains filtered or unexported fields
}
CompanyService provides access to client (company) API endpoints.
func (*CompanyService) Create ¶
func (s *CompanyService) Create(ctx context.Context, params CompanyCreateParams) (*Company, error)
Create creates a new company.
func (*CompanyService) Delete ¶
func (s *CompanyService) Delete(ctx context.Context, id string) error
Delete removes a company by ID.
func (*CompanyService) List ¶
func (s *CompanyService) List(ctx context.Context, params *CompanyListParams) *Iterator[Company]
List returns an iterator over all companies.
func (*CompanyService) Update ¶
func (s *CompanyService) Update(ctx context.Context, id string, params CompanyUpdateParams) (*Company, error)
Update modifies a company by ID.
type CompanyUpdateParams ¶
type CompanyUpdateParams struct {
Name *string `json:"name,omitempty"`
Code *string `json:"code,omitempty"`
Notes *string `json:"notes,omitempty"`
Timezone *string `json:"timezone,omitempty"`
ContactFirstName *string `json:"contact_first_name,omitempty"`
ContactLastName *string `json:"contact_last_name,omitempty"`
ContactEmail *string `json:"contact_email,omitempty"`
ContactPhone *string `json:"contact_phone,omitempty"`
}
CompanyUpdateParams are parameters for CompanyService.Update.
type ConnectionError ¶
type ConnectionError struct {
Err error
}
ConnectionError is returned when a connection to the API cannot be established.
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (e *ConnectionError) Unwrap() error
type Execution ¶
type Execution struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
WorkflowName string `json:"workflow_name"`
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
ClientID string `json:"client_id"`
ClientName string `json:"client_name"`
ExternalExecutionID *string `json:"external_execution_id"`
Status string `json:"status"`
StartedAt *string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
DurationMs *int `json:"duration_ms"`
DurationSeconds *float64 `json:"duration_seconds"`
ErrorCategory *string `json:"error_category"`
ErrorMessage *string `json:"error_message"`
ErrorPayload any `json:"error_payload"`
CreatedAt string `json:"created_at"`
}
Execution represents a workflow execution.
type ExecutionListParams ¶
type ExecutionListParams struct {
ListParams
ClientID *string
InstanceID *string
WorkflowID *string
Status *string
ErrorCategory *string
StartDate *string
EndDate *string
ErrorsOnly *bool
}
ExecutionListParams are parameters for ExecutionService.List.
type ExecutionService ¶
type ExecutionService struct {
// contains filtered or unexported fields
}
ExecutionService provides access to execution API endpoints (read-only).
func (*ExecutionService) List ¶
func (s *ExecutionService) List(ctx context.Context, params *ExecutionListParams) *Iterator[Execution]
List returns an iterator over executions.
type Instance ¶
type Instance struct {
ID string `json:"id"`
ServiceType string `json:"service_type"`
CompanyID string `json:"company_id"`
CompanyName string `json:"company_name"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
WorkflowsCount int `json:"workflows_count"`
SyncStatus string `json:"sync_status"`
LastSyncedAt *string `json:"last_synced_at"`
LastWorkflowsSyncedAt *string `json:"last_workflows_synced_at"`
LastExecutionsSyncedAt *string `json:"last_executions_synced_at"`
LastSyncError *string `json:"last_sync_error"`
Metrics *InstanceMetrics `json:"metrics"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Instance represents a connected service instance.
type InstanceCreateParams ¶
type InstanceCreateParams struct {
ClientID string `json:"-"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
ServiceType *string `json:"service_type,omitempty"`
}
InstanceCreateParams are parameters for InstanceService.Create.
type InstanceListParams ¶
type InstanceListParams struct {
ListParams
ClientID *string
ServiceType *string
SyncStatus *string
}
InstanceListParams are parameters for InstanceService.List.
type InstanceMetrics ¶
type InstanceMetrics struct {
ExecutionsCount int `json:"executions_count"`
SuccessRate *float64 `json:"success_rate"`
}
InstanceMetrics contains aggregate metrics for an instance.
type InstanceService ¶
type InstanceService struct {
// contains filtered or unexported fields
}
InstanceService provides access to instance API endpoints.
func (*InstanceService) Create ¶
func (s *InstanceService) Create(ctx context.Context, params InstanceCreateParams) (*Instance, error)
Create creates a new instance.
func (*InstanceService) Delete ¶
func (s *InstanceService) Delete(ctx context.Context, id string) error
Delete removes an instance by ID.
func (*InstanceService) List ¶
func (s *InstanceService) List(ctx context.Context, params *InstanceListParams) *Iterator[Instance]
List returns an iterator over instances.
func (*InstanceService) Sync ¶
func (s *InstanceService) Sync(ctx context.Context, id string, params *InstanceSyncParams) (map[string]any, error)
Sync triggers a sync for an instance.
func (*InstanceService) SyncAll ¶
func (s *InstanceService) SyncAll(ctx context.Context, params *InstanceSyncAllParams) (map[string]any, error)
SyncAll triggers a sync for all instances matching the given filters.
func (*InstanceService) Update ¶
func (s *InstanceService) Update(ctx context.Context, id string, params InstanceUpdateParams) (*Instance, error)
Update modifies an instance by ID.
type InstanceSyncAllParams ¶
type InstanceSyncAllParams struct {
SyncType *string `json:"-"`
ClientID *string `json:"-"`
ServiceType *string `json:"-"`
}
InstanceSyncAllParams are parameters for InstanceService.SyncAll.
type InstanceSyncParams ¶
type InstanceSyncParams struct {
SyncType *string `json:"sync_type,omitempty"`
}
InstanceSyncParams are parameters for InstanceService.Sync.
type InstanceUpdateParams ¶
type InstanceUpdateParams struct {
Name *string `json:"name,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
APIKey *string `json:"api_key,omitempty"`
ServiceType *string `json:"service_type,omitempty"`
}
InstanceUpdateParams are parameters for InstanceService.Update.
type InternalServerError ¶
type InternalServerError struct {
APIError
}
InternalServerError is returned for server-side errors (HTTP 5xx).
type Invitation ¶
type Invitation struct {
ID int `json:"id"`
Email string `json:"email"`
Role string `json:"role"`
ExpiresAt string `json:"expires_at"`
CreatedAt string `json:"created_at"`
}
Invitation represents a pending user invitation.
type Iterator ¶
type Iterator[T any] struct { // contains filtered or unexported fields }
Iterator provides lazy, auto-paginating iteration over list responses.
func (*Iterator[T]) Meta ¶
func (it *Iterator[T]) Meta() *PaginationMeta
Meta returns the pagination metadata from the most recently fetched page.
type LLMCostByClient ¶
type LLMCostByClient struct {
ID string `json:"id"`
Name string `json:"name"`
CostCents int `json:"cost_cents"`
Tokens int `json:"tokens"`
}
LLMCostByClient contains cost information for a single client.
type LLMCostByClientResponse ¶
type LLMCostByClientResponse struct {
Data []LLMCostByClient `json:"data"`
Meta LLMCostMeta `json:"meta"`
}
LLMCostByClientResponse is the response from the by_client endpoint.
type LLMCostByProviderResponse ¶
type LLMCostByProviderResponse struct {
Data []LLMCostProvider `json:"data"`
Meta LLMCostMeta `json:"meta"`
}
LLMCostByProviderResponse is the response from the by_provider endpoint.
type LLMCostDaily ¶
type LLMCostDaily struct {
Date string `json:"date"`
CostCents int `json:"cost_cents"`
Tokens int `json:"tokens"`
}
LLMCostDaily contains cost information for a single day.
type LLMCostData ¶
type LLMCostData struct {
Summary LLMCostSummary `json:"summary"`
Providers []LLMCostProvider `json:"providers"`
Models []LLMCostModel `json:"models"`
Daily []LLMCostDaily `json:"daily"`
}
LLMCostData is the data payload for the summary endpoint.
type LLMCostMeta ¶
LLMCostMeta contains date range metadata for cost responses.
type LLMCostModel ¶
type LLMCostModel struct {
Model string `json:"model"`
CostCents int `json:"cost_cents"`
Tokens int `json:"tokens"`
Requests int `json:"requests"`
}
LLMCostModel contains cost information for a single model.
type LLMCostParams ¶
LLMCostParams are parameters for LLM cost endpoints.
type LLMCostProvider ¶
type LLMCostProvider struct {
ID string `json:"id"`
Name string `json:"name"`
ProviderType string `json:"provider_type"`
CostCents int `json:"cost_cents"`
Tokens int `json:"tokens"`
Requests int `json:"requests"`
}
LLMCostProvider contains cost information for a single provider.
type LLMCostService ¶
type LLMCostService struct {
// contains filtered or unexported fields
}
LLMCostService provides access to LLM cost analytics endpoints.
func (*LLMCostService) ByClient ¶
func (s *LLMCostService) ByClient(ctx context.Context, params *LLMCostParams) (*LLMCostByClientResponse, error)
ByClient returns LLM costs broken down by client.
func (*LLMCostService) ByProvider ¶
func (s *LLMCostService) ByProvider(ctx context.Context, params *LLMCostParams) (*LLMCostByProviderResponse, error)
ByProvider returns LLM costs broken down by provider.
func (*LLMCostService) Summary ¶
func (s *LLMCostService) Summary(ctx context.Context, params *LLMCostParams) (*LLMCostSummaryResponse, error)
Summary returns aggregate LLM cost data.
type LLMCostSummary ¶
type LLMCostSummary struct {
TotalCostCents int `json:"total_cost_cents"`
TotalTokens int `json:"total_tokens"`
TotalInputTokens int `json:"total_input_tokens"`
TotalOutputTokens int `json:"total_output_tokens"`
TotalRequests int `json:"total_requests"`
ProvidersCount int `json:"providers_count"`
}
LLMCostSummary contains aggregate cost information.
type LLMCostSummaryResponse ¶
type LLMCostSummaryResponse struct {
Data LLMCostData `json:"data"`
Meta LLMCostMeta `json:"meta"`
}
LLMCostSummaryResponse is the response from the summary endpoint.
type LLMProject ¶
type LLMProject struct {
ID string `json:"id"`
ExternalID *string `json:"external_id"`
Name string `json:"name"`
ClientID *string `json:"client_id"`
ClientName *string `json:"client_name"`
TotalCostCents int `json:"total_cost_cents"`
TotalTokens int `json:"total_tokens"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
LLMProject represents a project within an LLM provider.
type LLMProjectListParams ¶
type LLMProjectListParams struct {
ListParams
}
LLMProjectListParams are parameters for LLMProjectService.List.
type LLMProjectService ¶
type LLMProjectService struct {
// contains filtered or unexported fields
}
LLMProjectService provides access to LLM project API endpoints. Projects are nested under LLM providers.
func (*LLMProjectService) List ¶
func (s *LLMProjectService) List(ctx context.Context, providerID string, params *LLMProjectListParams) *Iterator[LLMProject]
List returns an iterator over LLM projects for a provider.
func (*LLMProjectService) Update ¶
func (s *LLMProjectService) Update(ctx context.Context, providerID, projectID string, params LLMProjectUpdateParams) (*LLMProject, error)
Update modifies an LLM project's client assignment.
type LLMProjectUpdateParams ¶
type LLMProjectUpdateParams struct {
ClientID *string `json:"client_id"`
}
LLMProjectUpdateParams are parameters for LLMProjectService.Update.
type LLMProvider ¶
type LLMProvider struct {
ID string `json:"id"`
Name string `json:"name"`
ProviderType string `json:"provider_type"`
OrganizationID *string `json:"organization_id"`
ProjectsCount int `json:"projects_count"`
SyncStatus *string `json:"sync_status"`
LastSyncedAt *string `json:"last_synced_at"`
LastSyncError *string `json:"last_sync_error"`
Metrics *LLMProviderMetrics `json:"metrics"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
LLMProvider represents an LLM provider configuration.
type LLMProviderCreateParams ¶
type LLMProviderCreateParams struct {
Name string `json:"name"`
ProviderType string `json:"provider_type"`
APIKey string `json:"api_key"`
OrganizationID *string `json:"organization_id,omitempty"`
Config map[string]any `json:"config,omitempty"`
}
LLMProviderCreateParams are parameters for LLMProviderService.Create.
type LLMProviderListParams ¶
type LLMProviderListParams struct {
ListParams
}
LLMProviderListParams are parameters for LLMProviderService.List.
type LLMProviderMetrics ¶
type LLMProviderMetrics struct {
TotalCostCents int `json:"total_cost_cents"`
TotalTokens int `json:"total_tokens"`
TotalRequests int `json:"total_requests"`
}
LLMProviderMetrics contains aggregate metrics for an LLM provider.
type LLMProviderService ¶
type LLMProviderService struct {
// contains filtered or unexported fields
}
LLMProviderService provides access to LLM provider API endpoints.
func (*LLMProviderService) Create ¶
func (s *LLMProviderService) Create(ctx context.Context, params LLMProviderCreateParams) (*LLMProvider, error)
Create creates a new LLM provider.
func (*LLMProviderService) Delete ¶
func (s *LLMProviderService) Delete(ctx context.Context, id string) error
Delete removes an LLM provider by ID.
func (*LLMProviderService) Get ¶
func (s *LLMProviderService) Get(ctx context.Context, id string) (*LLMProvider, error)
Get returns an LLM provider by ID.
func (*LLMProviderService) List ¶
func (s *LLMProviderService) List(ctx context.Context, params *LLMProviderListParams) *Iterator[LLMProvider]
List returns an iterator over LLM providers.
func (*LLMProviderService) Update ¶
func (s *LLMProviderService) Update(ctx context.Context, id string, params LLMProviderUpdateParams) (*LLMProvider, error)
Update modifies an LLM provider by ID.
type LLMProviderUpdateParams ¶
type LLMProviderUpdateParams struct {
Name *string `json:"name,omitempty"`
APIKey *string `json:"api_key,omitempty"`
OrganizationID *string `json:"organization_id,omitempty"`
Config map[string]any `json:"config,omitempty"`
}
LLMProviderUpdateParams are parameters for LLMProviderService.Update.
type ListParams ¶
ListParams are common pagination parameters for list endpoints.
type MeResponse ¶
type MeResponse struct {
Token TokenInfo `json:"token"`
Account AccountInfo `json:"account"`
}
MeResponse is returned by AccountService.Me.
type NotFoundError ¶
type NotFoundError struct {
APIError
}
NotFoundError is returned when a resource is not found (HTTP 404).
type Option ¶
type Option func(*clientConfig)
Option configures a Client.
func WithBaseURL ¶
WithBaseURL sets the base URL for API requests. Default: "https://administrate.dev".
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retries for failed requests. Default: 3.
func WithTimeout ¶
WithTimeout sets the HTTP request timeout. Default: 30s.
type PaginationMeta ¶
type PaginationMeta struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
Total int `json:"total"`
TotalPages int `json:"total_pages"`
HasMore bool `json:"has_more"`
}
PaginationMeta contains pagination metadata from list responses.
type PermissionDeniedError ¶
type PermissionDeniedError struct {
APIError
}
PermissionDeniedError is returned when the API key lacks permission (HTTP 403).
type RateLimitError ¶
RateLimitError is returned when the rate limit is exceeded (HTTP 429).
type SyncHealthEntry ¶
type SyncHealthEntry struct {
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
ClientID string `json:"client_id"`
ClientName string `json:"client_name"`
SyncStatus string `json:"sync_status"`
LastSyncError *string `json:"last_sync_error"`
Workflows SyncHealthSyncInfo `json:"workflows"`
Executions SyncHealthSyncInfo `json:"executions"`
}
SyncHealthEntry represents the sync health status of an instance.
type SyncHealthSyncInfo ¶
type SyncHealthSyncInfo struct {
LastSyncedAt *string `json:"last_synced_at"`
LastRun *SyncRun `json:"last_run"`
}
SyncHealthSyncInfo contains sync timing information for a specific sync type.
type SyncRun ¶
type SyncRun struct {
ID string `json:"id"`
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
SyncType string `json:"sync_type"`
Status string `json:"status"`
StartedAt *string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
DurationSeconds *float64 `json:"duration_seconds"`
RecordsCreated int `json:"records_created"`
RecordsUpdated int `json:"records_updated"`
ErrorMessage *string `json:"error_message"`
CreatedAt string `json:"created_at"`
}
SyncRun represents a sync operation run.
type SyncRunListParams ¶
type SyncRunListParams struct {
ListParams
InstanceID *string
ClientID *string
SyncType *string
Status *string
StartDate *string
EndDate *string
}
SyncRunListParams are parameters for SyncRunService.List.
type SyncRunService ¶
type SyncRunService struct {
// contains filtered or unexported fields
}
SyncRunService provides access to sync run API endpoints.
func (*SyncRunService) Health ¶
func (s *SyncRunService) Health(ctx context.Context) ([]SyncHealthEntry, error)
Health returns the sync health status for all instances.
func (*SyncRunService) List ¶
func (s *SyncRunService) List(ctx context.Context, params *SyncRunListParams) *Iterator[SyncRun]
List returns an iterator over sync runs.
type TimeoutError ¶
type TimeoutError struct {
Err error
}
TimeoutError is returned when a request times out.
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
func (*TimeoutError) Unwrap ¶
func (e *TimeoutError) Unwrap() error
type TokenInfo ¶
type TokenInfo struct {
Name string `json:"name"`
Permission string `json:"permission"`
ExpiresAt *string `json:"expires_at"`
}
TokenInfo contains information about the current API token.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name *string `json:"name"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
Phone *string `json:"phone"`
Timezone *string `json:"timezone"`
AvatarURL *string `json:"avatar_url"`
Role string `json:"role"`
JoinedAt string `json:"joined_at"`
}
User represents a user in administrate.dev.
type UserInviteParams ¶
UserInviteParams are parameters for UserService.Invite.
type UserListParams ¶
type UserListParams struct {
ListParams
}
UserListParams are parameters for UserService.List.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService provides access to user-related API endpoints.
func (*UserService) Delete ¶
func (s *UserService) Delete(ctx context.Context, id string) error
Delete removes a user by ID.
func (*UserService) Invite ¶
func (s *UserService) Invite(ctx context.Context, params UserInviteParams) (*Invitation, error)
Invite sends an invitation to a new user.
func (*UserService) List ¶
func (s *UserService) List(ctx context.Context, params *UserListParams) *Iterator[User]
List returns an iterator over all users.
func (*UserService) Update ¶
func (s *UserService) Update(ctx context.Context, id string, params UserUpdateParams) (*User, error)
Update modifies a user's role by ID.
type UserUpdateParams ¶
type UserUpdateParams struct {
Role string `json:"role"`
}
UserUpdateParams are parameters for UserService.Update.
type ValidationError ¶
type ValidationError struct {
APIError
}
ValidationError is returned when request parameters are invalid (HTTP 422).
type Webhook ¶
type Webhook struct {
ID string `json:"id"`
URL string `json:"url"`
Description *string `json:"description"`
Events []string `json:"events"`
Enabled bool `json:"enabled"`
ConsecutiveFailures int `json:"consecutive_failures"`
LastTriggeredAt *string `json:"last_triggered_at"`
Secret *string `json:"secret"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Webhook represents a webhook configuration.
type WebhookCreateParams ¶
type WebhookCreateParams struct {
URL string `json:"url"`
Events []string `json:"events"`
Description *string `json:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
WebhookCreateParams are parameters for WebhookService.Create.
type WebhookListParams ¶
type WebhookListParams struct {
ListParams
}
WebhookListParams are parameters for WebhookService.List.
type WebhookService ¶
type WebhookService struct {
// contains filtered or unexported fields
}
WebhookService provides access to webhook API endpoints.
func (*WebhookService) Create ¶
func (s *WebhookService) Create(ctx context.Context, params WebhookCreateParams) (*Webhook, error)
Create creates a new webhook.
func (*WebhookService) Delete ¶
func (s *WebhookService) Delete(ctx context.Context, id string) error
Delete removes a webhook by ID.
func (*WebhookService) List ¶
func (s *WebhookService) List(ctx context.Context, params *WebhookListParams) *Iterator[Webhook]
List returns an iterator over all webhooks.
func (*WebhookService) RegenerateSecret ¶
RegenerateSecret generates a new secret for a webhook.
func (*WebhookService) Update ¶
func (s *WebhookService) Update(ctx context.Context, id string, params WebhookUpdateParams) (*Webhook, error)
Update modifies a webhook by ID.
type WebhookUpdateParams ¶
type WebhookUpdateParams struct {
URL *string `json:"url,omitempty"`
Events []string `json:"events,omitempty"`
Description *string `json:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
WebhookUpdateParams are parameters for WebhookService.Update.
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
CompanyID string `json:"company_id"`
CompanyName string `json:"company_name"`
ExternalWorkflowID *string `json:"external_workflow_id"`
Name string `json:"name"`
IsActive bool `json:"is_active"`
MinutesSavedPerSuccess *float64 `json:"minutes_saved_per_success"`
MinutesSavedPerFailure *float64 `json:"minutes_saved_per_failure"`
Metrics *WorkflowMetrics `json:"metrics"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Workflow represents an automation workflow.
type WorkflowListParams ¶
type WorkflowListParams struct {
ListParams
ClientID *string
InstanceID *string
Active *bool
Search *string
}
WorkflowListParams are parameters for WorkflowService.List.
type WorkflowMetrics ¶
type WorkflowMetrics struct {
ExecutionsCount int `json:"executions_count"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
SuccessRate *float64 `json:"success_rate"`
TimeSavedMinutes *float64 `json:"time_saved_minutes"`
}
WorkflowMetrics contains aggregate metrics for a workflow.
type WorkflowService ¶
type WorkflowService struct {
// contains filtered or unexported fields
}
WorkflowService provides access to workflow API endpoints.
func (*WorkflowService) List ¶
func (s *WorkflowService) List(ctx context.Context, params *WorkflowListParams) *Iterator[Workflow]
List returns an iterator over workflows.
func (*WorkflowService) Update ¶
func (s *WorkflowService) Update(ctx context.Context, id string, params WorkflowUpdateParams) (*Workflow, error)
Update modifies a workflow's time-saved settings by ID.
type WorkflowUpdateParams ¶
type WorkflowUpdateParams struct {
MinutesSavedPerSuccess *float64 `json:"minutes_saved_per_success,omitempty"`
MinutesSavedPerFailure *float64 `json:"minutes_saved_per_failure,omitempty"`
}
WorkflowUpdateParams are parameters for WorkflowService.Update.