administrate

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 10 Imported by: 0

README

Administrate Go SDK

The official Go SDK for the Administrate.dev REST API.

Administrate.dev is AI Agency Management software. It is a monitoring and management platform for AI agencies running n8n and AI automation workflows across multiple clients. It provides a single dashboard to track every workflow, every client, every failure, and all LLM costs, so you can catch problems before clients do and prove the value of your automations.

Key platform features:

  • Multi-instance monitoring — See all n8n instances across every client in one place
  • Error tracking — Real-time failure detection with automatic error categorization
  • LLM cost tracking — Connect OpenAI, Anthropic, Azure, and OpenRouter accounts to attribute costs to specific clients
  • Workflow insights — Execution counts, success rates, and time-saved ROI reporting
  • Sync health — Know instantly when a data sync fails
  • Webhooks & API — Full programmatic access for custom integrations

Installation

go get github.com/administrate-dev/administrate-go-sdk

Requires Go 1.22+. Zero external dependencies — stdlib only.

Quick start

package main

import (
	"context"
	"fmt"
	"log"

	administrate "github.com/administrate-dev/administrate-go-sdk"
)

func main() {
	client, err := administrate.NewClient("sk_live_...")
	if err != nil {
		log.Fatal(err)
	}

	ctx := context.Background()

	// Get account info
	account, err := client.Account.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(account.Name, account.Plan)

	// List all companies with auto-pagination
	iter := client.Companies.List(ctx, nil)
	for iter.Next() {
		c := iter.Value()
		fmt.Println(c.Name, c.N8NInstancesCount)
	}
	if err := iter.Err(); err != nil {
		log.Fatal(err)
	}

	// Check for failed executions across all instances
	execIter := client.Executions.List(ctx, &administrate.ExecutionListParams{
		ErrorsOnly: administrate.Bool(true),
	})
	for execIter.Next() {
		ex := execIter.Value()
		fmt.Printf("%s: %s\n", ex.WorkflowName, *ex.ErrorCategory)
	}

	// Get LLM cost summary
	costs, err := client.LLMCosts.Summary(ctx, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Total: $%.2f\n", float64(costs.Data.Summary.TotalCostCents)/100)
}

Configuration

client, err := administrate.NewClient(
	"sk_live_...",                                  // Required. Must start with "sk_live_"
	administrate.WithBaseURL("https://..."),         // Default: "https://administrate.dev"
	administrate.WithTimeout(10 * time.Second),      // Request timeout. Default: 30s
	administrate.WithMaxRetries(5),                  // Retry attempts for failed requests. Default: 3
)

You can also pass a pre-configured *http.Client if you need full control over the HTTP layer (proxies, custom TLS, etc.):

httpClient := &http.Client{
	Timeout:   15 * time.Second,
	Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
}
client, err := administrate.NewClient("sk_live_...", administrate.WithHTTPClient(httpClient))

API reference

All API keys are created in Settings > Developers within Administrate.dev. Tokens have three permission levels: read, write, and full.

All methods accept a context.Context as their first parameter for cancellation and timeout control.

Account
// Get current token info and account summary
me, err := client.Account.Me(ctx)
fmt.Println(me.Token.Name, me.Token.Permission)
fmt.Println(me.Account.Name, me.Account.Plan)

// Get full account details
account, err := client.Account.Get(ctx)

// Update account settings
account, err := client.Account.Update(ctx, administrate.AccountUpdateParams{
	Name:         administrate.String("My Agency"),
	BillingEmail: administrate.String("billing@example.com"),
	Timezone:     administrate.String("Australia/Brisbane"),
})
Companies

Companies represent the clients you manage automations for. (The API uses "clients" as the resource path — the Go SDK uses Company to avoid collision with Client.)

// List all companies (auto-paginates)
for iter := client.Companies.List(ctx, nil); iter.Next(); {
	c := iter.Value()
	fmt.Println(c.Name, c.Code)
}

// Get a company (includes 7-day metrics)
c, err := client.Companies.Get(ctx, "com_abc123")
fmt.Println(*c.Metrics.SuccessRate, *c.Metrics.TimeSavedMinutes)

// Create a company
c, err := client.Companies.Create(ctx, administrate.CompanyCreateParams{
	Name:         "Acme Corp",
	Code:         administrate.String("acme"),
	ContactEmail: administrate.String("ops@acme.com"),
	Timezone:     administrate.String("America/New_York"),
})

// Update a company
c, err := client.Companies.Update(ctx, "com_abc123", administrate.CompanyUpdateParams{
	Notes: administrate.String("Enterprise tier"),
})

// Delete a company (requires full permission)
err := client.Companies.Delete(ctx, "com_abc123")
Instances

Instances are n8n deployments connected to Administrate.

// List all instances
for iter := client.Instances.List(ctx, nil); iter.Next(); {
	inst := iter.Value()
	fmt.Println(inst.Name, inst.SyncStatus)
}

// Filter by client or sync status
iter := client.Instances.List(ctx, &administrate.InstanceListParams{
	ClientID:   administrate.String("com_abc123"),
	SyncStatus: administrate.String("error"),
})
for iter.Next() {
	inst := iter.Value()
	fmt.Println(inst.Name, *inst.LastSyncError)
}

// Get an instance (includes 7-day metrics)
inst, err := client.Instances.Get(ctx, "n8n_abc123")
fmt.Println(inst.Metrics.ExecutionsCount, *inst.Metrics.SuccessRate)

// Connect a new n8n instance
inst, err := client.Instances.Create(ctx, administrate.InstanceCreateParams{
	ClientID: "com_abc123",
	Name:     "Production n8n",
	BaseURL:  "https://n8n.acme.com",
	APIKey:   "n8n_api_key_here",
})

// Trigger a sync
result, err := client.Instances.Sync(ctx, "n8n_abc123", &administrate.InstanceSyncParams{
	SyncType: administrate.String("all"),
})

// Sync all instances at once
result, err := client.Instances.SyncAll(ctx, &administrate.InstanceSyncAllParams{
	SyncType: administrate.String("workflows"),
})

// Update an instance
inst, err := client.Instances.Update(ctx, "n8n_abc123", administrate.InstanceUpdateParams{
	Name: administrate.String("Staging n8n"),
})

// Delete an instance
err := client.Instances.Delete(ctx, "n8n_abc123")
Workflows
// List workflows with filters
iter := client.Workflows.List(ctx, &administrate.WorkflowListParams{
	ClientID: administrate.String("com_abc123"),
	Active:   administrate.Bool(true),
})
for iter.Next() {
	wf := iter.Value()
	fmt.Println(wf.Name, wf.IsActive)
}

// Search by name
iter := client.Workflows.List(ctx, &administrate.WorkflowListParams{
	Search: administrate.String("onboarding"),
})
for iter.Next() {
	fmt.Println(iter.Value().Name)
}

// Get a workflow (includes 7-day metrics)
wf, err := client.Workflows.Get(ctx, "wfl_abc123")
fmt.Println(*wf.Metrics.SuccessRate, *wf.Metrics.TimeSavedMinutes)

// Set time-saved estimates (for ROI reporting)
wf, err := client.Workflows.Update(ctx, "wfl_abc123", administrate.WorkflowUpdateParams{
	MinutesSavedPerSuccess: administrate.Float64(15),
	MinutesSavedPerFailure: administrate.Float64(5),
})
Executions

Executions are read-only records of workflow runs synced from n8n.

// List executions with filters
iter := client.Executions.List(ctx, &administrate.ExecutionListParams{
	ClientID:  administrate.String("com_abc123"),
	Status:    administrate.String("failed"),
	StartDate: administrate.String("2025-01-01"),
	EndDate:   administrate.String("2025-01-31"),
})
for iter.Next() {
	ex := iter.Value()
	fmt.Println(ex.WorkflowName, ex.Status, *ex.DurationMs)
}

// Get only errors
iter := client.Executions.List(ctx, &administrate.ExecutionListParams{
	ErrorsOnly: administrate.Bool(true),
})
for iter.Next() {
	ex := iter.Value()
	fmt.Println(*ex.ErrorCategory, ex.WorkflowName)
}

// Get execution details (includes error message and payload)
ex, err := client.Executions.Get(ctx, "exe_abc123")
fmt.Println(*ex.ErrorMessage)
fmt.Println(ex.ErrorPayload)
Sync runs
// List sync run history
iter := client.SyncRuns.List(ctx, &administrate.SyncRunListParams{
	InstanceID: administrate.String("n8n_abc123"),
	Status:     administrate.String("failed"),
})
for iter.Next() {
	run := iter.Value()
	fmt.Println(run.SyncType, run.Status, *run.DurationSeconds)
}

// Get a specific sync run
run, err := client.SyncRuns.Get(ctx, "syn_abc123")

// Get sync health across all instances
entries, err := client.SyncRuns.Health(ctx)
for _, entry := range entries {
	fmt.Println(entry.InstanceName, entry.SyncStatus)
	fmt.Printf("  Workflows last synced: %v\n", entry.Workflows.LastSyncedAt)
	fmt.Printf("  Executions last synced: %v\n", entry.Executions.LastSyncedAt)
}
Users
// List team members
for iter := client.Users.List(ctx, nil); iter.Next(); {
	user := iter.Value()
	fmt.Println(*user.Name, user.Email, user.Role)
}

// Get a user
user, err := client.Users.Get(ctx, "usr_abc123")

// Invite a new team member
invitation, err := client.Users.Invite(ctx, administrate.UserInviteParams{
	Email: "new@example.com",
	Role:  administrate.String("member"),
})
fmt.Println(invitation.ExpiresAt)

// Change a user's role
user, err := client.Users.Update(ctx, "usr_abc123", administrate.UserUpdateParams{
	Role: "admin",
})

// Remove a user
err := client.Users.Delete(ctx, "usr_abc123")
Webhooks
// List webhooks
for iter := client.Webhooks.List(ctx, nil); iter.Next(); {
	wh := iter.Value()
	fmt.Println(wh.URL, wh.Events, wh.Enabled)
}

// Create a webhook
wh, err := client.Webhooks.Create(ctx, administrate.WebhookCreateParams{
	URL:         "https://example.com/hook",
	Events:      []string{"execution.failed", "sync.failed"},
	Description: administrate.String("Slack failure alerts"),
})
fmt.Println(*wh.Secret) // Save this — used to verify webhook signatures

// Update a webhook
wh, err := client.Webhooks.Update(ctx, "whk_abc123", administrate.WebhookUpdateParams{
	Enabled: administrate.Bool(false),
})

// Regenerate the signing secret (old secret becomes invalid immediately)
wh, err := client.Webhooks.RegenerateSecret(ctx, "whk_abc123")
fmt.Println(*wh.Secret)

// Delete a webhook
err := client.Webhooks.Delete(ctx, "whk_abc123")
API tokens
// List all tokens
for iter := client.APITokens.List(ctx, nil); iter.Next(); {
	tok := iter.Value()
	fmt.Println(tok.Name, tok.Permission, tok.TokenHint)
}

// Create a token (the plain token is only returned once)
tok, err := client.APITokens.Create(ctx, administrate.APITokenCreateParams{
	Name:        "CI/CD Pipeline",
	Permission:  administrate.String("read"),
	IPAllowlist: []string{"10.0.0.0/8"},
	ExpiresIn:   administrate.String("90_days"),
})
fmt.Println(*tok.Token) // sk_live_... — save this immediately

// Update a token
tok, err := client.APITokens.Update(ctx, "tok_abc123", administrate.APITokenUpdateParams{
	Name: administrate.String("Updated Name"),
})

// Revoke a token
err := client.APITokens.Delete(ctx, "tok_abc123")
LLM providers

Connect your AI provider accounts to track costs.

// List providers
for iter := client.LLMProviders.List(ctx, nil); iter.Next(); {
	p := iter.Value()
	fmt.Println(p.Name, p.ProviderType, *p.SyncStatus)
}

// Get a provider (includes 7-day metrics)
provider, err := client.LLMProviders.Get(ctx, "llm_abc123")
fmt.Println(provider.Metrics.TotalCostCents, provider.Metrics.TotalTokens)

// Connect a new provider
provider, err := client.LLMProviders.Create(ctx, administrate.LLMProviderCreateParams{
	Name:           "OpenAI Production",
	ProviderType:   "openai", // openai, anthropic, openrouter, or azure
	APIKey:         "sk-...",
	OrganizationID: administrate.String("org-..."),
})

// Trigger a cost sync
result, err := client.LLMProviders.Sync(ctx, "llm_abc123")

// Update a provider
provider, err := client.LLMProviders.Update(ctx, "llm_abc123", administrate.LLMProviderUpdateParams{
	Name: administrate.String("OpenAI Staging"),
})

// Delete a provider
err := client.LLMProviders.Delete(ctx, "llm_abc123")
LLM projects

Projects are discovered automatically when syncing a provider. Assign them to clients to attribute costs.

// List projects for a provider
for iter := client.LLMProjects.List(ctx, "llm_abc123", nil); iter.Next(); {
	p := iter.Value()
	fmt.Println(p.Name, p.TotalCostCents, p.ClientName)
}

// Assign a project to a client
project, err := client.LLMProjects.Update(ctx, "llm_abc123", "proj_456", administrate.LLMProjectUpdateParams{
	ClientID: administrate.String("com_abc123"),
})
LLM costs
// Get cost summary (defaults to last 7 days)
costs, err := client.LLMCosts.Summary(ctx, nil)
fmt.Printf("Total: $%.2f\n", float64(costs.Data.Summary.TotalCostCents)/100)
fmt.Printf("Tokens: %d\n", costs.Data.Summary.TotalTokens)

// Breakdown by provider
for _, p := range costs.Data.Providers {
	fmt.Printf("  %s: $%.2f\n", p.Name, float64(p.CostCents)/100)
}

// Breakdown by model
for _, m := range costs.Data.Models {
	fmt.Printf("  %s: $%.2f\n", m.Model, float64(m.CostCents)/100)
}

// Daily trend
for _, day := range costs.Data.Daily {
	fmt.Printf("  %s: $%.2f\n", day.Date, float64(day.CostCents)/100)
}

// Custom date range
costs, err := client.LLMCosts.Summary(ctx, &administrate.LLMCostParams{
	StartDate: administrate.String("2025-01-01"),
	EndDate:   administrate.String("2025-01-31"),
})

// Costs by client
byClient, err := client.LLMCosts.ByClient(ctx, nil)
for _, entry := range byClient.Data {
	fmt.Printf("%s: $%.2f\n", entry.Name, float64(entry.CostCents)/100)
}

// Costs by provider
byProvider, err := client.LLMCosts.ByProvider(ctx, nil)
for _, entry := range byProvider.Data {
	fmt.Printf("%s: $%.2f\n", entry.Name, float64(entry.CostCents)/100)
}

Pagination

All .List() methods return an Iterator[T] that handles pagination automatically. By default, the API returns 25 items per page (max 100).

// Auto-paginate through all results
for iter := client.Companies.List(ctx, nil); iter.Next(); {
	fmt.Println(iter.Value().Name)
}

// Control page size
iter := client.Companies.List(ctx, &administrate.CompanyListParams{
	ListParams: administrate.ListParams{PerPage: administrate.Int(100)},
})
for iter.Next() {
	fmt.Println(iter.Value().Name)
}

// Collect all results into a slice
companies, err := client.Companies.List(ctx, nil).Collect()

// Access pagination metadata
iter := client.Companies.List(ctx, nil)
for iter.Next() {
	fmt.Println(iter.Value().Name)
}
fmt.Println(iter.Meta().Total, iter.Meta().TotalPages)
Pointer helpers

Use the provided helper functions to set optional pointer fields in param structs:

administrate.String("value")   // *string
administrate.Int(42)           // *int
administrate.Bool(true)        // *bool
administrate.Float64(3.14)     // *float64

Error handling

The SDK returns typed errors for all API failures, compatible with errors.As():

import "errors"

company, err := client.Companies.Get(ctx, "com_nonexistent")
if err != nil {
	var notFound *administrate.NotFoundError
	var authErr *administrate.AuthenticationError
	var rateLimited *administrate.RateLimitError
	var validationErr *administrate.ValidationError
	var apiErr *administrate.APIError

	switch {
	case errors.As(err, &notFound):
		fmt.Printf("Not found: %s\n", notFound.Message)
	case errors.As(err, &authErr):
		fmt.Println("Invalid API key")
	case errors.As(err, &rateLimited):
		fmt.Printf("Rate limited. Retry after %v\n", rateLimited.RetryAfter)
	case errors.As(err, &validationErr):
		fmt.Printf("Invalid params: %s\n", validationErr.Body)
	case errors.As(err, &apiErr):
		fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Message)
	default:
		fmt.Printf("Unexpected error: %v\n", err)
	}
}

Error type hierarchy:

Error type Status code Description
*APIError Any non-2xx Base for all HTTP API errors
*AuthenticationError 401 Invalid or missing API key
*PermissionDeniedError 403 Insufficient token permissions
*NotFoundError 404 Resource does not exist
*ValidationError 422 Invalid request parameters
*RateLimitError 429 Rate limit exceeded (has RetryAfter)
*InternalServerError 5xx Server-side error
*ConnectionError Failed to connect to the API
*TimeoutError Request timed out

All *APIError types expose StatusCode, Message, and Body (raw response text).

Retries

The SDK automatically retries failed requests with exponential backoff:

  • 429 (rate limited) — Retries after the duration specified in the Retry-After header
  • 5xx (server errors) — Retries with exponential backoff (0.5s, 1s, 2s, ...)
  • Connection errors and timeouts — Retried with the same backoff schedule

By default, the SDK retries up to 3 times. Set WithMaxRetries(0) to disable:

client, err := administrate.NewClient("sk_live_...", administrate.WithMaxRetries(0))

Requirements

  • Go 1.22+
  • No external dependencies (stdlib only)

License

MIT

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the given bool value.

func Float64

func Float64(v float64) *float64

Float64 returns a pointer to the given float64 value.

func Int

func Int(v int) *int

Int returns a pointer to the given int value.

func String

func String(v string) *string

String returns a pointer to the given string value.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Body       string
}

APIError represents an error returned by the administrate.dev API.

func (*APIError) Error

func (e *APIError) Error() string

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

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) Get

func (s *APITokenService) Get(ctx context.Context, id string) (*ApiToken, error)

Get returns an API token by ID.

func (*APITokenService) List

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

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

type ApiTokenCreatedBy struct {
	ID   string  `json:"id"`
	Name *string `json:"name"`
}

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.

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

NewClient creates a new administrate.dev API client. The apiKey must start with "sk_live_".

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) Get

func (s *CompanyService) Get(ctx context.Context, id string) (*Company, error)

Get returns a company by ID.

func (*CompanyService) List

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) Get

func (s *ExecutionService) Get(ctx context.Context, id string) (*Execution, error)

Get returns an execution by ID.

func (*ExecutionService) List

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

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) Get

func (s *InstanceService) Get(ctx context.Context, id string) (*Instance, error)

Get returns an instance by ID.

func (*InstanceService) List

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]) Collect

func (it *Iterator[T]) Collect() ([]T, error)

Collect drains the iterator and returns all items as a slice.

func (*Iterator[T]) Err

func (it *Iterator[T]) Err() error

Err returns the first error encountered during iteration.

func (*Iterator[T]) Meta

func (it *Iterator[T]) Meta() *PaginationMeta

Meta returns the pagination metadata from the most recently fetched page.

func (*Iterator[T]) Next

func (it *Iterator[T]) Next() bool

Next advances the iterator to the next item. It returns false when there are no more items or an error has occurred.

func (*Iterator[T]) Value

func (it *Iterator[T]) Value() T

Value returns the current item. Call only after Next returns true.

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

type LLMCostMeta struct {
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
}

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

type LLMCostParams struct {
	StartDate *string
	EndDate   *string
}

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

ByClient returns LLM costs broken down by client.

func (*LLMCostService) ByProvider

ByProvider returns LLM costs broken down by provider.

func (*LLMCostService) Summary

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

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

Get returns an LLM provider by ID.

func (*LLMProviderService) List

List returns an iterator over LLM providers.

func (*LLMProviderService) Sync

func (s *LLMProviderService) Sync(ctx context.Context, id string) (map[string]any, error)

Sync triggers a sync for an LLM provider.

func (*LLMProviderService) Update

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

type ListParams struct {
	Page    *int
	PerPage *int
}

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

func WithBaseURL(url string) Option

WithBaseURL sets the base URL for API requests. Default: "https://administrate.dev".

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets the maximum number of retries for failed requests. Default: 3.

func WithTimeout

func WithTimeout(d time.Duration) Option

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

type RateLimitError struct {
	APIError
	RetryAfter *time.Duration
}

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) Get

func (s *SyncRunService) Get(ctx context.Context, id string) (*SyncRun, error)

Get returns a sync run by ID.

func (*SyncRunService) Health

func (s *SyncRunService) Health(ctx context.Context) ([]SyncHealthEntry, error)

Health returns the sync health status for all instances.

func (*SyncRunService) List

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

type UserInviteParams struct {
	Email string  `json:"email"`
	Role  *string `json:"role,omitempty"`
}

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) Get

func (s *UserService) Get(ctx context.Context, id string) (*User, error)

Get returns 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) Get

func (s *WebhookService) Get(ctx context.Context, id string) (*Webhook, error)

Get returns a webhook by ID.

func (*WebhookService) List

List returns an iterator over all webhooks.

func (*WebhookService) RegenerateSecret

func (s *WebhookService) RegenerateSecret(ctx context.Context, id string) (*Webhook, error)

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) Get

func (s *WorkflowService) Get(ctx context.Context, id string) (*Workflow, error)

Get returns a workflow by ID.

func (*WorkflowService) List

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.

Jump to

Keyboard shortcuts

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