api

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeRecipeExport

func CanonicalizeRecipeExport(raw []byte) ([]byte, error)

CanonicalizeRecipeExport converts the raw GET /recipes/{id} response into the project recipe file format produced by the package-export path (wk pull) and required by wk lint. The single-recipe endpoint differs from the package format in ways that otherwise make its output fail lint:

  • "code" is returned as an escaped JSON string; lint requires an object.
  • the recipe version is exposed as "version_no"; the project format key is "version".
  • "private" and "concurrency" are not returned by this endpoint at all, so they fall back to the platform defaults (false / 1). Faithful values for these two require the package export (wk pull).

Runtime-only fields from the GET response (job counts, webhook_url, etc.) are intentionally dropped: a project recipe file is a definition, not a status snapshot, matching what wk pull writes.

Types

type APIClient

type APIClient struct {
	ID                 int                `json:"id"`
	Name               string             `json:"name"`
	AuthType           string             `json:"auth_type,omitempty"`
	IsLegacy           bool               `json:"is_legacy"`
	MTLSEnabled        bool               `json:"mtls_enabled"`
	ActiveAPIKeysCount int                `json:"active_api_keys_count"`
	TotalAPIKeysCount  int                `json:"total_api_keys_count"`
	APICollections     []APICollectionRef `json:"api_collections,omitempty"`
	APIKeys            []APIKey           `json:"api_keys,omitempty"`
	CreatedAt          time.Time          `json:"created_at"`
	UpdatedAt          time.Time          `json:"updated_at"`
}

APIClient represents a Workato API Platform client (v2 API). The API wraps responses in {"data":...}; unwrapping happens in the service layer.

type APIClientService

type APIClientService interface {
	List(ctx context.Context, opts *PaginationOptions) ([]APIClient, error)
	Get(ctx context.Context, id int) (*APIClient, error)
	Create(ctx context.Context, name string, collectionIDs []string, authType string) (*APIClient, error)
	Delete(ctx context.Context, id int) error
	CreateKey(ctx context.Context, clientID int, name string) (*APIKey, error)
	RefreshKey(ctx context.Context, clientID, keyID int) (*APIKey, error)
}

APIClientService defines operations on API Platform clients (v2 API).

type APICollection

type APICollection struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	Version    string `json:"version,omitempty"`
	URL        string `json:"url,omitempty"`
	APISpecURL string `json:"api_spec_url,omitempty"`
	ProjectID  *int   `json:"project_id,omitempty"`
}

APICollection represents a Workato API collection. The API does not support description on collections (silently ignored), and project_id is nullable (omitted when the collection has no project association).

type APICollectionRef

type APICollectionRef struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

APICollectionRef is a lightweight reference to a collection embedded in an API client response.

type APICollectionService

type APICollectionService interface {
	List(ctx context.Context, opts *PaginationOptions) ([]APICollection, error)
	Create(ctx context.Context, name string, projectID *int) (*APICollection, error)
	Delete(ctx context.Context, id int) error
}

APICollectionService defines operations on API collections.

type APIEndpoint

type APIEndpoint struct {
	ID              int     `json:"id"`
	Name            string  `json:"name"`
	APICollectionID int     `json:"api_collection_id"`
	Active          bool    `json:"active"`
	Method          string  `json:"method,omitempty"`
	Path            string  `json:"path,omitempty"`
	URL             string  `json:"url,omitempty"`
	FlowID          int     `json:"flow_id,omitempty"`
	RecipeID        int     `json:"recipe_id,omitempty"`
	Description     *string `json:"description,omitempty"`
}

APIEndpoint represents a Workato API endpoint. The API consistently uses "flow_id" for the recipe association (both list and create). RecipeID is backfilled from FlowID for display convenience.

type APIEndpointService

type APIEndpointService interface {
	List(ctx context.Context, collectionID *int, opts *PaginationOptions) ([]APIEndpoint, error)
	Create(ctx context.Context, collectionID int, data []byte) (*APIEndpoint, error)
	Enable(ctx context.Context, id int) error
	Disable(ctx context.Context, id int) error
}

APIEndpointService defines operations on API endpoints.

type APIError

type APIError struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
	ErrorType  string `json:"error_type,omitempty"`
}

APIError represents an error response from the Workato API.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Is

func (e *APIError) Is(target error) bool

Is maps HTTP status codes to the sentinel errors in internal/errors so callers can use errors.Is(err, wkerrors.ErrAPINotFound) without reaching into the concrete type. 5xx responses all match ErrAPIServer.

func (*APIError) IsNotFound

func (e *APIError) IsNotFound() bool

IsNotFound returns true if the error is a 404.

func (*APIError) IsRateLimit

func (e *APIError) IsRateLimit() bool

IsRateLimit returns true if the error is a 429.

func (*APIError) IsUnauthorized

func (e *APIError) IsUnauthorized() bool

IsUnauthorized returns true if the error is a 401.

type APIKey

type APIKey struct {
	ID          int      `json:"id"`
	Name        string   `json:"name"`
	AuthType    string   `json:"auth_type,omitempty"`
	AuthToken   string   `json:"auth_token,omitempty"`
	Active      bool     `json:"active"`
	ActiveSince *string  `json:"active_since,omitempty"`
	IPAllowList []string `json:"ip_allow_list,omitempty"`
	IPDenyList  []string `json:"ip_deny_list,omitempty"`
}

APIKey represents an API key belonging to an API client (v2 API). AuthToken is only populated on create — subsequent reads omit it.

type ActivationError added in v1.0.3

type ActivationError struct {
	RecipeID     int
	CodeErrors   []StepCodeErrors
	ConfigErrors []StepCodeErrors
}

ActivationError reports why the platform refused to activate a recipe. PUT /recipes/{id}/start returns HTTP 200 with success:false and a code_errors payload when activation is blocked; see the fixtures in recipes_test.go for recorded shapes.

func (*ActivationError) Error added in v1.0.3

func (e *ActivationError) Error() string

type AuditLogEntry

type AuditLogEntry struct {
	ID        int    `json:"id"`
	EventType string `json:"event_type"`
	Timestamp string `json:"timestamp"`
	User      struct {
		ID    int    `json:"id"`
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"user"`
	Details any `json:"details,omitempty"`
}

AuditLogEntry represents a Workato audit log entry.

type AuditLogOptions

type AuditLogOptions struct {
	Since  string
	Until  string
	Action string
}

AuditLogOptions configures audit log filtering.

type Client

type Client interface {
	Recipes() RecipeService
	Connections() ConnectionService
	Folders() FolderService
	Packages() PackageService
	Tags() TagService
	APICollections() APICollectionService
	APIEndpoints() APIEndpointService
	APIClients() APIClientService
	Skills() SkillService
	MCPServers() MCPServerService
	Workspace() WorkspaceService
	Connectors() ConnectorService
}

Client is the top-level API client providing access to all services.

type ClientOption

type ClientOption func(*HTTPClient)

ClientOption configures the HTTPClient.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) ClientOption

WithHTTPClient sets a custom http.Client.

func WithTimeout

func WithTimeout(d time.Duration) ClientOption

WithTimeout sets the HTTP timeout.

func WithVerbose

func WithVerbose(v bool) ClientOption

WithVerbose enables verbose logging.

type Connection

type Connection struct {
	ID                  int       `json:"id"`
	Name                string    `json:"name"`
	Application         string    `json:"application"`
	FolderID            int       `json:"folder_id"`
	AuthorizationStatus *string   `json:"authorization_status"`
	AuthorizationError  *string   `json:"authorization_error"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
}

Connection represents a Workato connection.

type ConnectionListOptions

type ConnectionListOptions struct {
	FolderID *int
	Page     int
	PerPage  int
}

ConnectionListOptions configures connection list filtering.

type ConnectionService

type ConnectionService interface {
	List(ctx context.Context, opts *ConnectionListOptions) ([]Connection, error)
	Get(ctx context.Context, id int) (*Connection, error)
	Create(ctx context.Context, name, provider string, folderID *int) (*Connection, error)
	Update(ctx context.Context, id int, name string) (*Connection, error)
	Delete(ctx context.Context, id int) error
	Disconnect(ctx context.Context, id int) error
}

ConnectionService defines operations on connections.

type Connector

type Connector struct {
	Name        string `json:"name"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
}

Connector represents a Workato connector (integration).

type ConnectorService

type ConnectorService interface {
	List(ctx context.Context, search string) ([]Connector, error)
}

ConnectorService defines operations on connectors.

type ErrorDescriptor added in v1.0.3

type ErrorDescriptor struct {
	ErrorType   string     `json:"error_type,omitempty"`
	ErrorID     string     `json:"error_id,omitempty"`
	LineNumber  *int       `json:"line_number,omitempty"`
	Adapter     string     `json:"adapter,omitempty"`
	ErrorAt     *time.Time `json:"error_at,omitempty"`
	ErrorTypeID *string    `json:"error_type_id,omitempty"`
	Actionable  bool       `json:"actionable,omitempty"`
	Action      *string    `json:"action,omitempty"`
	Trigger     *string    `json:"trigger,omitempty"`
}

ErrorDescriptor carries a structured error classification for a failed job step, when the API provides one.

type ErrorDetails added in v1.0.3

type ErrorDetails struct {
	Message      string        `json:"message,omitempty"`
	InnerMessage *string       `json:"inner_message,omitempty"`
	HTTPResponse *HTTPResponse `json:"http_response,omitempty"`
}

ErrorDetails holds the diagnostic payload for a failed step, most importantly the downstream HTTP response that caused the failure.

type ErrorParts added in v1.0.3

type ErrorParts struct {
	Message    string `json:"message,omitempty"`
	ErrorType  string `json:"error_type,omitempty"`
	ErrorID    string `json:"error_id,omitempty"`
	Action     string `json:"action,omitempty"`
	LineNumber *int   `json:"line_number,omitempty"`
	Adapter    string `json:"adapter,omitempty"`
	RetryCount int    `json:"retry_count,omitempty"`
}

ErrorParts is the job-level structured error breakdown returned alongside the flat error string.

type ExportManifest

type ExportManifest struct {
	ID       int    `json:"id"`
	Name     string `json:"name,omitempty"`
	Status   string `json:"status,omitempty"`
	FolderID int    `json:"folder_id,omitempty"`
}

ExportManifest represents a Workato RLCM export manifest. Creating a manifest is required before triggering a package export.

type FieldCodeError added in v1.0.3

type FieldCodeError struct {
	Label   string
	Value   any
	Message string
	Path    string
}

FieldCodeError is one field-level activation error within a step.

func (*FieldCodeError) UnmarshalJSON added in v1.0.3

func (f *FieldCodeError) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the positional tuple [label, current_value, message] with an optional fourth path element. Observed live shapes: schema errors carry four elements ([label, value, message, path]); invalid-name errors carry three; config_errors reuse the layout with a non-string fourth element, so the tail is decoded best-effort.

type Folder

type Folder struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	ParentID  *int   `json:"parent_id,omitempty"`
	IsProject bool   `json:"is_project,omitempty"`
	ProjectID int    `json:"project_id,omitempty"`
}

Folder represents a Workato folder. IsProject distinguishes top-level projects from plain folders — the Workato workspace treats them as the same resource shape on list, but delete routes differently: projects require DELETE /projects/{project_id}; plain folders use DELETE /folders/{id}.

ProjectID is populated by the list response when IsProject is true and is the identifier that DELETE /projects/... requires — distinct from ID (the folder id) even when the folder IS a project.

type FolderService

type FolderService interface {
	List(ctx context.Context, parentID *int) ([]Folder, error)
	ListProjects(ctx context.Context) ([]Folder, error)
	Create(ctx context.Context, name string, parentID *int) (*Folder, error)
	Update(ctx context.Context, id int, name *string, parentID *int) (*Folder, error)
	UpdateProject(ctx context.Context, projectID int, name string) (*Folder, error)
	Delete(ctx context.Context, id int) error
	DeleteProject(ctx context.Context, id int) error
}

FolderService defines operations on folders. The Workato API does not expose a single-folder-by-ID endpoint; callers that need to verify a cached folder_id must walk the hierarchy via List and compare.

Projects (is_project == true) use a separate DELETE endpoint and must go through DeleteProject; plain folders use Delete. Callers inspect Folder.IsProject from List results to route appropriately.

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient implements the Client interface using HTTP.

func NewHTTPClient

func NewHTTPClient(baseURL, token string, opts ...ClientOption) *HTTPClient

NewHTTPClient creates a new API client.

func (*HTTPClient) APIClients

func (c *HTTPClient) APIClients() APIClientService

func (*HTTPClient) APICollections

func (c *HTTPClient) APICollections() APICollectionService

func (*HTTPClient) APIEndpoints

func (c *HTTPClient) APIEndpoints() APIEndpointService

func (*HTTPClient) Connections

func (c *HTTPClient) Connections() ConnectionService

func (*HTTPClient) Connectors

func (c *HTTPClient) Connectors() ConnectorService

func (*HTTPClient) Folders

func (c *HTTPClient) Folders() FolderService

func (*HTTPClient) MCPServers

func (c *HTTPClient) MCPServers() MCPServerService

func (*HTTPClient) Packages

func (c *HTTPClient) Packages() PackageService

func (*HTTPClient) Recipes

func (c *HTTPClient) Recipes() RecipeService

func (*HTTPClient) Skills

func (c *HTTPClient) Skills() SkillService

func (*HTTPClient) Tags

func (c *HTTPClient) Tags() TagService

func (*HTTPClient) Workspace

func (c *HTTPClient) Workspace() WorkspaceService

type HTTPResponse added in v1.0.3

type HTTPResponse struct {
	Protocol             string          `json:"protocol,omitempty"`
	Code                 int             `json:"code,omitempty"`
	RawStatusText        string          `json:"raw_status_text,omitempty"`
	NormalizedStatusText string          `json:"normalized_status_text,omitempty"`
	Body                 string          `json:"body,omitempty"`
	Headers              json.RawMessage `json:"headers,omitempty"`
}

HTTPResponse is the downstream HTTP response captured on a step failure (e.g. a 401 from a called API). Headers are returned as raw JSON since the key set is arbitrary.

type Job

type Job struct {
	ID              string     `json:"id"`
	RecipeID        int        `json:"recipe_id"`
	Status          string     `json:"status"` // "succeeded", "failed", "pending"
	StartedAt       *time.Time `json:"started_at,omitempty"`
	CompletedAt     *time.Time `json:"completed_at,omitempty"`
	Title           string     `json:"title,omitempty"`
	IsError         bool       `json:"is_error"`
	Error           *string    `json:"error,omitempty"`
	IsPollError     bool       `json:"is_poll_error"`
	CallingRecipeID *int       `json:"calling_recipe_id,omitempty"`
	CallingJobID    *string    `json:"calling_job_id,omitempty"`
	RootRecipeID    *int       `json:"root_recipe_id,omitempty"`
	RootJobID       *string    `json:"root_job_id,omitempty"`
	MasterJobID     *string    `json:"master_job_id,omitempty"`
}

Job represents a recipe job execution. Job IDs are strings (e.g. "j-AJMfQh8c-hsCXcs"); recipe IDs are integers.

type JobDetail

type JobDetail struct {
	Job
	Handle           string      `json:"handle,omitempty"`
	IsRepeat         bool        `json:"is_repeat"`
	IsTest           bool        `json:"is_test"`
	IsTestCaseJob    bool        `json:"is_test_case_job"`
	MasterJobHandle  string      `json:"master_job_handle,omitempty"`
	CallingJobHandle string      `json:"calling_job_handle,omitempty"`
	Lines            []JobLine   `json:"lines,omitempty"`
	ErrorParts       *ErrorParts `json:"error_parts,omitempty"`
	JobCorrelationID string      `json:"job_correlation_id,omitempty"`
}

JobDetail is the single-job response from GET /recipes/{id}/jobs/{job_id}.

type JobLine

type JobLine struct {
	RecipeLineNumber int              `json:"recipe_line_number"`
	AdapterName      string           `json:"adapter_name"`
	AdapterOperation string           `json:"adapter_operation"`
	LineStat         *LineStat        `json:"line_stat,omitempty"`
	Input            json.RawMessage  `json:"input,omitempty"`
	Output           json.RawMessage  `json:"output,omitempty"`
	Error            *string          `json:"error,omitempty"`
	ErrorDescriptor  *ErrorDescriptor `json:"error_descriptor,omitempty"`
	ErrorDetails     *ErrorDetails    `json:"error_details,omitempty"`
}

JobLine represents a single step in a job execution trace. Beyond the step identity and timing, the API returns the step's input/output data and, on failures, full error diagnostics (error_details.http_response). Input/Output are held as raw JSON because their shape is per-adapter.

type JobListOptions

type JobListOptions struct {
	Status string
	Limit  int
}

JobListOptions configures job list filtering.

type LineStat

type LineStat struct {
	StartedAt   *time.Time       `json:"started_at,omitempty"`
	CompletedAt *time.Time       `json:"completed_at,omitempty"`
	Total       *float64         `json:"total,omitempty"`
	Details     []LineStatDetail `json:"details,omitempty"`
}

LineStat holds timing data for a job step. Total is the step's total duration in seconds (a fractional value, e.g. 0.0079); Details breaks that down into sub-phases.

type LineStatDetail added in v1.0.3

type LineStatDetail struct {
	Name    string   `json:"name,omitempty"`
	Count   *int     `json:"count,omitempty"`
	Average *float64 `json:"average,omitempty"`
	Total   *float64 `json:"total,omitempty"`
	Min     *float64 `json:"min,omitempty"`
	Max     *float64 `json:"max,omitempty"`
}

LineStatDetail is one sub-phase of a step's timing breakdown. The API reports each sub-phase as a set of duration metrics in seconds (Count is the sample count); there is no scalar "value" field.

type ListResult

type ListResult[T any] struct {
	Items []T `json:"items"`
}

ListResult is a generic wrapper for paginated API responses that return {"items":[...]}, e.g. recipes and jobs.

type MCPManagedServer

type MCPManagedServer struct {
	ID                   string                  `json:"id"`
	Name                 string                  `json:"name"`
	Description          string                  `json:"description,omitempty"`
	AssetType            string                  `json:"asset_type,omitempty"`
	LogoURL              *string                 `json:"logo_url,omitempty"`
	MCPURL               string                  `json:"mcp_url,omitempty"`
	AuthType             string                  `json:"auth_type,omitempty"`
	AuthenticationMethod string                  `json:"authentication_method,omitempty"`
	FolderID             int                     `json:"folder_id"`
	ProjectID            int                     `json:"project_id"`
	Folders              []MCPServerFolder       `json:"folders,omitempty"`
	HasVUADependentTools bool                    `json:"has_vua_dependent_tools"`
	IDPUserGroupIDs      []string                `json:"idp_user_group_ids,omitempty"`
	APICollection        *MCPServerCollectionRef `json:"api_collection,omitempty"`
	ToolsCount           int                     `json:"tools_count"`
	CreatedAt            time.Time               `json:"created_at"`
	UpdatedAt            time.Time               `json:"updated_at"`
}

MCPManagedServer is the full detail shape from GET /api/mcp/mcp_servers/:handle. The API wraps responses in {"data":...}; unwrapping happens in the service layer. IDs are strings (e.g. "mcps-AYcNrsC8-Dd8-AB").

type MCPServerCollectionRef

type MCPServerCollectionRef struct {
	ID        int       `json:"id"`
	Type      string    `json:"type,omitempty"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

MCPServerCollectionRef is the API collection linked to an MCP server.

type MCPServerFolder

type MCPServerFolder struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

MCPServerFolder is a lightweight folder reference embedded in an MCP server response.

type MCPServerInfo

type MCPServerInfo struct {
	Name            string         `json:"name"`
	Version         string         `json:"version"`
	ProtocolVersion string         `json:"protocol_version"`
	Capabilities    map[string]any `json:"capabilities,omitempty"`
}

MCPServerInfo represents the result of an MCP initialize handshake.

type MCPServerListOptions

type MCPServerListOptions struct {
	ProjectID            *int
	FolderID             *int
	AuthenticationMethod string
	Page                 int
	PerPage              int
}

MCPServerListOptions configures MCP server list filtering.

type MCPServerPolicy

type MCPServerPolicy struct {
	ID          *int    `json:"id"`
	MCPServerID *string `json:"mcp_server_id"`
	// RateLimits/QuotaLimits are {"limit": <int>, "interval": <string>}
	// objects; the values are mixed types, so decode into map[string]any.
	RateLimits  map[string]any `json:"rate_limits,omitempty"`
	QuotaLimits map[string]any `json:"quota_limits,omitempty"`
	IPAllowList []string       `json:"ip_allow_list,omitempty"`
	IPDenyList  []string       `json:"ip_deny_list,omitempty"`
	CreatedAt   *time.Time     `json:"created_at,omitempty"`
	UpdatedAt   *time.Time     `json:"updated_at,omitempty"`
}

MCPServerPolicy represents rate/quota limits and IP restrictions for an MCP server.

type MCPServerService

type MCPServerService interface {
	List(ctx context.Context, opts *MCPServerListOptions) ([]MCPManagedServer, error)
	Get(ctx context.Context, handle string) (*MCPManagedServer, error)
	Create(ctx context.Context, name string, folderID int, description string, assetID *int) (*MCPManagedServer, error)
	Update(ctx context.Context, handle string, opts map[string]any) (*MCPManagedServer, error)
	Delete(ctx context.Context, handle string) error
	TokenRenew(ctx context.Context, handle string) (*MCPManagedServer, error)
	ListTools(ctx context.Context, handle string, opts *PaginationOptions) ([]MCPServerTool, error)
	AssignTools(ctx context.Context, handle string, tools []map[string]any) error
	UpdateTool(ctx context.Context, handle string, toolID int, opts map[string]any) (*MCPServerTool, error)
	DeleteTool(ctx context.Context, handle string, toolID int) error
	GetServerPolicies(ctx context.Context, handle string) (*MCPServerPolicy, error)
	SetServerPolicies(ctx context.Context, handle string, policy map[string]any) (*MCPServerPolicy, error)
	AssignUserGroups(ctx context.Context, handle string, groupIDs []string) error
	RemoveUserGroups(ctx context.Context, handle string, groupIDs []string) error
	ListUserGroups(ctx context.Context, opts *PaginationOptions) ([]MCPUserGroup, error)
}

MCPServerService defines operations on MCP managed servers (/api/mcp/mcp_servers).

type MCPServerTool

type MCPServerTool struct {
	ID                     int      `json:"id"`
	Name                   string   `json:"name"`
	Description            *string  `json:"description,omitempty"`
	OriginalDescription    *string  `json:"original_description,omitempty"`
	TriggerApplication     *string  `json:"trigger_application,omitempty"`
	ActionApplications     []string `json:"action_applications,omitempty"`
	FlowID                 int      `json:"flow_id"`
	Active                 bool     `json:"active"`
	Enabled                bool     `json:"enabled"`
	VUARequired            bool     `json:"vua_required"`
	IncompatibilityReasons []string `json:"incompatibility_reasons,omitempty"`
}

MCPServerTool represents a tool assigned to an MCP managed server.

type MCPTool

type MCPTool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
	Annotations map[string]any `json:"annotations,omitempty"`
}

MCPTool represents a tool exposed by an MCP server.

type MCPUserGroup

type MCPUserGroup struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	UsersCount int       `json:"users_count"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

MCPUserGroup is an identity-provider user group from GET /api/mcp/user_groups. IDs are strings (e.g. "group-abc123") and are what assign/remove_user_groups expect in idp_user_group_ids.

type MutationRefusedError added in v1.0.3

type MutationRefusedError struct {
	Op      string
	Reasons []string
}

MutationRefusedError reports a 2xx mutation response whose body carries success:false — the platform acknowledged the request but refused to apply it (e.g. deleting or updating a recipe that is currently running). Several recipe lifecycle endpoints use this shape instead of a 4xx status.

func (*MutationRefusedError) Error added in v1.0.3

func (e *MutationRefusedError) Error() string

type Package

type Package struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	Status     string    `json:"status"`
	Error      string    `json:"error,omitempty"`
	ErrorParts []any     `json:"error_parts,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Package represents an RLCM export/import package.

type PackageContent

type PackageContent struct {
	AbsolutePath string `json:"absolute_path"`
	ZipName      string `json:"zip_name"`
	Folder       string `json:"folder"`
	Type         string `json:"type"` // "recipe", "connection", etc.
}

PackageContent describes a single asset within an RLCM package.

type PackageService

type PackageService interface {
	Export(ctx context.Context, folderID int) (int, error) // returns package ID
	ExportStatus(ctx context.Context, packageID int) (*Package, error)
	Download(ctx context.Context, packageID int) ([]byte, error)
	Import(ctx context.Context, folderID int, data []byte, restartRecipes bool) (int, error) // returns import ID
	ImportStatus(ctx context.Context, importID int) (*Package, error)
}

PackageService defines operations on RLCM packages (export/import).

type PaginationOptions

type PaginationOptions struct {
	Page    int
	PerPage int
}

PaginationOptions provides generic pagination parameters.

type Recipe

type Recipe struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	FolderID    int       `json:"folder_id"`
	Running     bool      `json:"running"`
	Active      bool      `json:"active"`
	Version     int       `json:"version"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Code        any       `json:"code,omitempty"`
	Config      any       `json:"config,omitempty"`
	// TriggerApplication identifies the recipe's trigger connector (e.g.
	// "workato_api_platform"). The MCP tools API keys recipe tools on it.
	TriggerApplication string `json:"trigger_application,omitempty"`
}

Recipe represents a Workato recipe.

type RecipeListOptions

type RecipeListOptions struct {
	FolderID *int
	Status   string // "running", "stopped", "all"
	Page     int
	PerPage  int
}

RecipeListOptions configures recipe list filtering.

type RecipeService

type RecipeService interface {
	List(ctx context.Context, opts *RecipeListOptions) ([]Recipe, error)
	Get(ctx context.Context, id int) (*Recipe, error)
	Start(ctx context.Context, id int) error
	Stop(ctx context.Context, id int) error
	Export(ctx context.Context, id int) ([]byte, error)
	Import(ctx context.Context, folderID int, data []byte) (*Recipe, error)
	Update(ctx context.Context, id int, data []byte) error
	Delete(ctx context.Context, id int) error
	Move(ctx context.Context, id, folderID int) error
	ListJobs(ctx context.Context, recipeID int, opts *JobListOptions) ([]Job, error)
	GetJob(ctx context.Context, recipeID int, jobID string) (*JobDetail, error)
	Copy(ctx context.Context, recipeID, folderID int) (*Recipe, error)
	Connect(ctx context.Context, recipeID int, adapterName string, connectionID int) error
	RepeatJobs(ctx context.Context, recipeID int, jobIDs []string) (*RepeatJobsResult, error)
	ListVersions(ctx context.Context, recipeID, page, perPage int) ([]RecipeVersion, error)
	GetVersion(ctx context.Context, recipeID, versionID int) (*RecipeVersion, error)
	UpdateVersionComment(ctx context.Context, recipeID, versionID int, comment string) (*RecipeVersion, error)
}

RecipeService defines operations on recipes.

type RecipeVersion

type RecipeVersion struct {
	ID          int       `json:"id"`
	VersionNo   int       `json:"version_no"`
	Comment     *string   `json:"comment,omitempty"`
	AuthorName  string    `json:"author_name"`
	AuthorEmail string    `json:"author_email"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

RecipeVersion represents a single entry in a recipe's version history (GET /recipes/:id/versions). Comment is a pointer because the API may return null for versions that were never commented; *string preserves the distinction between "no comment" and "empty comment".

type RepeatJobEntry

type RepeatJobEntry struct {
	JobID  string `json:"job_id"`
	Status string `json:"status"` // "enqueued" or "failed"
	Error  string `json:"error,omitempty"`
}

RepeatJobEntry describes the outcome of a single job repeat request.

type RepeatJobsResult

type RepeatJobsResult struct {
	Results []RepeatJobEntry `json:"results"`
}

RepeatJobsResult is the response from POST /recipes/:id/repeat_jobs.

type Skill

type Skill struct {
	ID                 string `json:"id"`
	Name               string `json:"name"`
	Description        string `json:"description,omitempty"`
	RecipeID           int    `json:"recipe_id,omitempty"`
	ProviderID         int    `json:"provider_id"`
	ProviderType       string `json:"provider_type,omitempty"`
	FolderID           int    `json:"folder_id"`
	ProjectID          int    `json:"project_id"`
	Running            bool   `json:"running"`
	GeniesCount        int    `json:"genies_count"`
	TriggerDescription string `json:"trigger_description,omitempty"`
	Applications       []any  `json:"applications,omitempty"`
}

Skill represents a Workato agentic skill. The API returns string IDs (e.g. "skl-Aa6zhmTh-4ac8TH-AB") and uses "provider_id" for the recipe association; RecipeID is backfilled from ProviderID for display convenience.

type SkillService

type SkillService interface {
	List(ctx context.Context, opts *PaginationOptions) ([]Skill, error)
	Get(ctx context.Context, id string) (*Skill, error)
	Create(ctx context.Context, recipeID int) (*Skill, error)
}

SkillService defines operations on agentic skills.

type StepCodeErrors added in v1.0.3

type StepCodeErrors struct {
	Step    int
	Details []FieldCodeError
}

StepCodeErrors groups activation errors for one recipe step (by step number).

func (*StepCodeErrors) UnmarshalJSON added in v1.0.3

func (s *StepCodeErrors) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the positional pair [step_number, [field errors]].

type Tag

type Tag struct {
	Handle      string `json:"handle"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Color       string `json:"color,omitempty"`
}

Tag represents a Workato tag.

type TagListOptions

type TagListOptions struct {
	Search  string
	Page    int
	PerPage int
}

TagListOptions configures tag list filtering.

type TagService

type TagService interface {
	List(ctx context.Context, opts *TagListOptions) ([]Tag, error)
	Create(ctx context.Context, title, description, color string) (*Tag, error)
	Update(ctx context.Context, handle string, opts *TagUpdateOptions) (*Tag, error)
	Delete(ctx context.Context, handle string) error
	Assign(ctx context.Context, addTags, removeTags []string, recipeIDs, connectionIDs []int) error
}

TagService defines operations on tags.

type TagUpdateOptions

type TagUpdateOptions struct {
	Title       *string
	Description *string
	Color       *string
}

TagUpdateOptions configures tag updates.

type WorkspaceInfo

type WorkspaceInfo struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

WorkspaceInfo is the shape returned by GET /users/me. Despite the endpoint path, the response describes the workspace the token authenticates against: id and name are the workspace's. Email is the authenticated account's email.

type WorkspaceService

type WorkspaceService interface {
	GetCurrentWorkspace(ctx context.Context) (*WorkspaceInfo, error)
	ListMembers(ctx context.Context, email string) ([]WorkspaceUser, error)
	GetAuditLogs(ctx context.Context, opts *AuditLogOptions) ([]AuditLogEntry, error)
	ListProperties(ctx context.Context, prefix string) (map[string]string, error)
	SetProperties(ctx context.Context, properties map[string]string) error
}

WorkspaceService defines operations on workspace management.

type WorkspaceUser

type WorkspaceUser struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

WorkspaceUser represents a Workato workspace member (from GET /members).

Jump to

Keyboard shortcuts

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