manager

package module
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

README

manager-sdk-go

Go SDK for the babelforce manager APIs — auth, user & agent management, call reporting, metrics, and task automations.

One client, configured once, exposes resource namespaces over the API. Authentication, paging, and error handling are handled for you.

📖 Docs: https://babelforce.github.io/manager-sdk/

Install

go get github.com/babelforce/manager-sdk-go
import (
    manager "github.com/babelforce/manager-sdk-go"
    managerapi "github.com/babelforce/manager-sdk-go/gen/manager" // request & model types
)

Usage

mgr, err := manager.Connect(ctx, manager.Options{
    Auth: manager.ClientCredentials(clientID, clientSecret), // or manager.Password(user, pass)
    // BaseURL defaults to https://services.babelforce.com
})
if err != nil {
    log.Fatal(err)
}

// list users (auto-paginated)
for user, err := range mgr.Users.List(ctx, manager.ListUsersQuery{}) {
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(user.Email)
}

_, err = mgr.Users.Create(ctx, managerapi.CreateManagedUserRequest{Email: "new.user@acme.com"})
Authentication
  • manager.RefreshToken(refreshToken, clientID) — a refresh token from the Authorization Code + PKCE flow (helpers: manager.GeneratePKCE, manager.BuildAuthorizeURL, manager.AuthorizationCodeGrant); transparent refresh with rotation. Best for apps acting on behalf of a user.
  • manager.ClientCredentials(clientID, clientSecret) — OAuth2 client_credentials grant with transparent refresh, for server-to-server use (credential issuance is in security review — see the Authentication guide).
  • manager.Bearer(token) — a token you already hold.
  • manager.Password(user, pass) — OAuth2 password grant (legacy) with transparent refresh.
Errors

Non-2xx responses return a typed *manager.APIError (Status, Code, Message, Body).

Custom host
manager.Connect(ctx, manager.Options{
    BaseURL: "https://acme.babelforce.com",
    Auth:    manager.Bearer(token),
})

License

Apache-2.0

Documentation

Overview

Package manager is the babelforce manager SDK for Go.

It provides an intuitive, hand-written client over the babelforce manager APIs — auth, user & agent management, call reporting, metrics, and task automations. Configure one ManagerClient with Connect, authenticate once, and use its resource namespaces.

mgr, err := manager.Connect(ctx, manager.Options{
    Auth: manager.ClientCredentials(clientID, clientSecret),
})
for user, err := range mgr.Users.List(ctx, manager.ListUsersQuery{}) {
    if err != nil { return err }
    fmt.Println(user.Email)
}

The low-level clients under gen/ are generated from the OpenAPI specs and are an internal detail; this package is the public surface.

Index

Constants

View Source
const DefaultBaseURL = "https://services.babelforce.com"

DefaultBaseURL is the babelforce API host used when Options.BaseURL is empty.

Variables

This section is empty.

Functions

func BuildAuthorizeURL added in v0.40.0

func BuildAuthorizeURL(p AuthorizeURLParams) string

BuildAuthorizeURL builds the GET {BaseURL}/oauth/authorize URL that starts the Authorization Code + PKCE flow. Redirect the user to it; babelforce redirects back to RedirectURI with a short-lived code.

Types

type APIError

type APIError struct {
	// Status is the HTTP status code.
	Status int
	// Code is the API error code, when the body carries one.
	Code string
	// Message is a human-readable message (from the body when available, else the status text).
	Message string
	// Body is the raw response body.
	Body []byte
}

APIError is returned when the manager API responds with a non-2xx status.

func (*APIError) Error

func (e *APIError) Error() string

type AgentGroupsResource added in v0.3.0

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

AgentGroupsResource is the agent-groups namespace (/api/v2/agents/groups).

func (*AgentGroupsResource) AddAgent added in v0.3.0

func (r *AgentGroupsResource) AddAgent(ctx context.Context, groupID, agentID string) (*managerapi.AgentGroupAdditionResponse, error)

AddAgent adds an agent (by id) to a group.

func (*AgentGroupsResource) BulkDelete added in v0.38.0

BulkDelete deletes the given agent groups by id.

func (*AgentGroupsResource) Create added in v0.3.0

Create creates an agent group.

func (*AgentGroupsResource) Delete added in v0.3.0

func (r *AgentGroupsResource) Delete(ctx context.Context, id string) error

Delete deletes an agent group by id.

func (*AgentGroupsResource) Get added in v0.3.0

Get returns an agent group by id.

func (*AgentGroupsResource) List added in v0.3.0

List returns an iterator over agent groups, auto-paginating across pages.

func (*AgentGroupsResource) ListAgents added in v0.38.0

ListAgents returns an iterator over the agents in a group, auto-paginating across pages.

The Page field of params is managed by the auto-paginator, so leave it unset.

func (*AgentGroupsResource) ListAll added in v0.3.0

func (r *AgentGroupsResource) ListAll(ctx context.Context, pageSize int) ([]managerapi.AgentGroup, error)

ListAll collects every agent group into a slice (convenience over List).

func (*AgentGroupsResource) RemoveAgent added in v0.38.0

func (r *AgentGroupsResource) RemoveAgent(ctx context.Context, groupID, agentID string) (*managerapi.AgentGroupItemResponse, error)

RemoveAgent removes an agent (by id) from a group.

func (*AgentGroupsResource) Update added in v0.3.0

Update updates an agent group.

type AgentsResource added in v0.3.0

type AgentsResource struct {

	// Groups is the agent-groups sub-namespace (/api/v2/agents/groups).
	Groups *AgentGroupsResource
	// contains filtered or unexported fields
}

AgentsResource is the agent-management namespace (/api/v2/agents).

func (*AgentsResource) AllLogs added in v0.38.0

AllLogs returns an iterator over every agent's log entries, auto-paginating across pages.

The Page field of params is managed by the auto-paginator, so leave it unset.

func (*AgentsResource) AvailableStatuses added in v0.38.0

AvailableStatuses lists the agent availability statuses.

func (*AgentsResource) BulkAction added in v0.38.0

BulkAction applies a bulk action (e.g. "enable", "disable", "delete") to the given agent ids.

func (*AgentsResource) Create added in v0.3.0

Create creates an agent.

func (*AgentsResource) CreatePresence added in v0.38.0

CreatePresence creates an available agent presence.

func (*AgentsResource) Delete added in v0.3.0

func (r *AgentsResource) Delete(ctx context.Context, id string) error

Delete deletes an agent by id.

func (*AgentsResource) DeletePresence added in v0.38.0

DeletePresence deletes an available agent presence by name.

func (*AgentsResource) Disable added in v0.38.0

Disable disables an agent by id.

func (*AgentsResource) Enable added in v0.38.0

Enable enables an agent by id.

func (*AgentsResource) Export added in v0.38.0

func (r *AgentsResource) Export(ctx context.Context, format string) ([]byte, error)

Export returns all agents as a raw export in the given format (e.g. "csv").

func (*AgentsResource) Get added in v0.3.0

Get returns an agent by id.

func (*AgentsResource) GetImportJob added in v0.38.0

GetImportJob returns an asynchronous agent-import job by id.

func (*AgentsResource) GetPresence added in v0.38.0

GetPresence returns an available agent presence by name.

func (*AgentsResource) GetStatus added in v0.38.0

GetStatus returns the total status of an agent by id.

func (*AgentsResource) HangupCall added in v0.38.0

HangupCall hangs up the active call of an agent by id.

func (*AgentsResource) Import added in v0.38.0

Import provisions agents from an upload stream (e.g. a CSV body). contentType is e.g. "text/csv".

func (*AgentsResource) List added in v0.3.0

List returns an iterator over agents, auto-paginating across pages.

for agent, err := range mgr.Agents.List(ctx, manager.ListAgentsQuery{}) {
    if err != nil { return err }
    fmt.Println(agent.Name)
}

func (*AgentsResource) ListAll added in v0.3.0

ListAll collects every agent into a slice (convenience over List).

func (*AgentsResource) Logs added in v0.38.0

Logs returns an iterator over a single agent's log entries, auto-paginating across pages.

The Page field of params is managed by the auto-paginator, so leave it unset.

func (*AgentsResource) Presences added in v0.38.0

Presences lists the available agent presences.

func (*AgentsResource) Push added in v0.38.0

Push sends a push notification / event to an agent.

func (*AgentsResource) Update added in v0.3.0

Update updates an agent.

func (*AgentsResource) UpdatePassword added in v0.38.0

UpdatePassword updates the password of an agent by id.

func (*AgentsResource) UpdatePresence added in v0.38.0

UpdatePresence updates an available agent presence by name.

func (*AgentsResource) UpdateStatus added in v0.3.0

UpdateStatus updates an agent's status (enabled flag and/or presence).

func (*AgentsResource) ValidateImport added in v0.38.0

func (r *AgentsResource) ValidateImport(ctx context.Context, contentType string, body io.Reader) (*managerapi.AgentImportValidationResults, error)

ValidateImport validates an agent import upload stream without applying it. contentType is e.g. "text/csv".

type AppActionsResource added in v0.4.0

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

AppActionsResource is the per-application actions (local automations) namespace (/api/v2/applications/{applicationId}/actions).

func (*AppActionsResource) Create added in v0.4.0

Create creates an action in an application.

func (*AppActionsResource) Delete added in v0.4.0

func (r *AppActionsResource) Delete(ctx context.Context, applicationID, id string) error

Delete deletes one of an application's actions.

func (*AppActionsResource) Get added in v0.4.0

Get returns one of an application's actions by id.

func (*AppActionsResource) List added in v0.4.0

func (r *AppActionsResource) List(ctx context.Context, applicationID string, pageSize int) iter.Seq2[managerapi.LocalAutomation, error]

List returns an iterator over an application's actions, auto-paginating across pages.

func (*AppActionsResource) ListAll added in v0.4.0

func (r *AppActionsResource) ListAll(ctx context.Context, applicationID string, pageSize int) ([]managerapi.LocalAutomation, error)

ListAll collects every action of an application into a slice (convenience over List).

func (*AppActionsResource) Update added in v0.4.0

Update updates one of an application's actions.

type ApplicationView added in v0.5.0

type ApplicationView struct {
	Id          string           `json:"id"`
	Name        string           `json:"name"`
	Module      string           `json:"module"`
	Enabled     bool             `json:"enabled"`
	DateCreated time.Time        `json:"dateCreated"`
	LastUpdated time.Time        `json:"lastUpdated"`
	Tags        []managerapi.Tag `json:"tags"`
}

ApplicationView holds the fields every IVR application variant shares, regardless of its module. managerapi.Application is a oneOf union (a distinct shape per module), so it carries no directly addressable fields; use ApplicationViewOf to read the common ones. For module-specific fields (routings, settings, …) use the generated app.As<Module>Application() accessors or app.ValueByDiscriminator().

func ApplicationViewOf added in v0.5.0

func ApplicationViewOf(app managerapi.Application) (ApplicationView, error)

ApplicationViewOf extracts the fields common to every Application variant. It also works on the Application returned inside ApplicationItemResponse.Item (Get/Create/Update).

type ApplicationsResource added in v0.4.0

type ApplicationsResource struct {

	// Actions is the per-application actions (local automations) sub-namespace
	// (/api/v2/applications/{applicationId}/actions).
	Actions *AppActionsResource
	// contains filtered or unexported fields
}

ApplicationsResource is the application (IVR) management namespace (/api/v2/applications).

func (*ApplicationsResource) AllLocalAutomations added in v0.38.0

AllLocalAutomations returns an iterator over every local automation across all applications, auto-paginating across pages (GET /api/v2/automations/local). The Page field of params is managed by the auto-paginator, so leave it unset.

func (*ApplicationsResource) BulkUpdate added in v0.38.0

BulkUpdate applies a partial update to many applications at once (PUT /api/v2/applications/bulk).

func (*ApplicationsResource) Clone added in v0.38.0

Clone duplicates an application and returns the new copy (POST /api/v2/applications/{id}/clone).

func (*ApplicationsResource) Create added in v0.4.0

Create creates an application.

func (*ApplicationsResource) Delete added in v0.4.0

func (r *ApplicationsResource) Delete(ctx context.Context, id string) error

Delete deletes an application by id.

func (*ApplicationsResource) DeleteMany added in v0.4.0

DeleteMany bulk-deletes applications by id.

func (*ApplicationsResource) Dispatch added in v0.4.0

Dispatch dispatches the local automations configured at a position in an application. The body is optional: pass nil to send no request payload, or a non-nil *LocalAutomationDispatch to send one.

func (*ApplicationsResource) Get added in v0.4.0

Get returns an application by id.

func (*ApplicationsResource) List added in v0.4.0

List returns an iterator over applications, auto-paginating across pages.

for app, err := range mgr.Applications.List(ctx, manager.ListApplicationsQuery{}) {
    if err != nil { return err }
    v, _ := manager.ApplicationViewOf(app)
    fmt.Println(v.Id, v.Name, v.Module)
}

func (*ApplicationsResource) ListActions added in v0.38.0

ListActions lists every action across all applications (GET /api/v2/applications/actions).

func (*ApplicationsResource) ListAll added in v0.4.0

ListAll collects every application into a slice (convenience over List).

func (*ApplicationsResource) ListErrors added in v0.38.0

ListErrors lists application configuration errors (GET /api/v2/applications/errors).

func (*ApplicationsResource) ListModules added in v0.4.0

ListModules lists the available IVR modules (the building blocks of applications).

func (*ApplicationsResource) Update added in v0.4.0

Update updates an application.

type AuditSettings added in v0.4.0

AuditSettings groups the `audit` settings.

type Auth

type Auth interface {
	// contains filtered or unexported methods
}

Auth describes how the SDK authenticates. Construct one with ClientCredentials, Bearer, or Password.

func Bearer

func Bearer(token string) Auth

Bearer authenticates with a bearer token you already hold.

func ClientCredentials added in v0.38.0

func ClientCredentials(clientID, clientSecret string) Auth

ClientCredentials authenticates via the OAuth2 client_credentials grant against /oauth/token (the primary server-to-server mode). The token is fetched lazily on first use and refreshed transparently before it expires.

func Password

func Password(user, pass string) Auth

Password authenticates via the OAuth2 password grant against /oauth/token. The token is fetched lazily on first use and refreshed transparently before it expires. Convenience for interactive/dev use.

func RefreshToken added in v0.40.0

func RefreshToken(refreshToken, clientID string) Auth

RefreshToken authenticates using a refresh token obtained from the Authorization Code + PKCE flow. The token is exchanged for an access token lazily on first use and refreshed transparently before it expires; the rotated refresh token returned by each exchange is captured and reused. clientID is the registered public client id used at /oauth/authorize. This is the recommended way to run a long-lived client on behalf of a user.

type AuthResource added in v0.38.0

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

AuthResource is the OAuth 2.0 namespace (/oauth): authorize, token, and revoke.

These endpoints authenticate via OAuth client credentials carried in the request itself, so they operate independently of the client's configured authentication (via Options.Auth).

func (*AuthResource) Authorize added in v0.38.0

Authorize begins the OAuth 2.0 Authorization Code flow at /oauth/authorize. On success the server responds with a redirect (302) carrying the authorization code; the returned response exposes the raw HTTP response (including Location header) for the caller to follow.

func (*AuthResource) Revoke added in v0.38.0

Revoke invalidates an access or refresh token at /oauth/revoke.

func (*AuthResource) Token added in v0.38.0

Token exchanges OAuth 2.0 credentials (a grant) for an access token at /oauth/token.

type AuthorizeURLParams added in v0.40.0

type AuthorizeURLParams struct {
	BaseURL             string
	ClientID            string
	RedirectURI         string
	Scope               string
	CodeChallenge       string
	State               string // optional
	CodeChallengeMethod string // optional; defaults to "S256"
}

AuthorizeURLParams are the inputs to BuildAuthorizeURL.

type AutomationsResource added in v0.17.0

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

AutomationsResource is the global-automations namespace (event triggers, /api/v2/events/triggers).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*AutomationsResource) BulkDelete added in v0.38.0

BulkDelete deletes several global automations (event triggers) by id.

func (*AutomationsResource) BulkUpdate added in v0.38.0

BulkUpdate updates several global automations (event triggers) in one request. Each item in the body must include its id.

func (*AutomationsResource) Clone added in v0.38.0

Clone clones a global automation (event trigger) and returns the new automation.

func (*AutomationsResource) Create added in v0.17.0

Create creates a global automation.

func (*AutomationsResource) Delete added in v0.17.0

func (r *AutomationsResource) Delete(ctx context.Context, id string) error

Delete deletes a global automation.

func (*AutomationsResource) Dispatch added in v0.38.0

func (r *AutomationsResource) Dispatch(ctx context.Context, eventTriggerID string, params *managerapi.DispatchEventTriggerParams, body map[string]any) (map[string]any, error)

Dispatch dispatches a global automation (event trigger) with a payload and returns the raw result.

func (*AutomationsResource) Get added in v0.17.0

Get returns a global automation by id.

func (*AutomationsResource) List added in v0.17.0

List returns an iterator over global automations, auto-paginating across pages.

func (*AutomationsResource) ListAll added in v0.17.0

ListAll collects every global automation into a slice (convenience over List).

func (*AutomationsResource) Update added in v0.17.0

Update updates a global automation.

type BabeldeskResource added in v0.17.0

type BabeldeskResource struct {

	// Widgets is the babeldesk-widgets sub-namespace (/api/v2/babeldesk/widgets).
	Widgets *BabeldeskWidgetsResource
	// contains filtered or unexported fields
}

BabeldeskResource is the babeldesk-dashboards namespace (/api/v2/babeldesk/dashboards), with a nested Widgets sub-resource.

func (*BabeldeskResource) Create added in v0.17.0

Create creates a dashboard.

func (*BabeldeskResource) Delete added in v0.17.0

func (r *BabeldeskResource) Delete(ctx context.Context, id string) error

Delete deletes a dashboard.

func (*BabeldeskResource) Get added in v0.17.0

Get returns a dashboard by id.

func (*BabeldeskResource) List added in v0.17.0

List returns an iterator over babeldesk dashboards, auto-paginating across pages.

func (*BabeldeskResource) ListAll added in v0.17.0

ListAll collects every dashboard into a slice (convenience over List).

func (*BabeldeskResource) Update added in v0.17.0

Update updates a dashboard.

func (*BabeldeskResource) WidgetSettings added in v0.38.0

func (r *BabeldeskResource) WidgetSettings(ctx context.Context, widgetType string) (*managerapi.WidgetSettingsResponse, error)

WidgetSettings returns the UI feature flags and type-specific settings for a widget type (GET /api/v2/widget/{type}/settings).

type BabeldeskWidgetsResource added in v0.17.0

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

BabeldeskWidgetsResource is the babeldesk-widgets namespace (/api/v2/babeldesk/widgets).

func (*BabeldeskWidgetsResource) Create added in v0.17.0

Create creates a widget.

func (*BabeldeskWidgetsResource) Delete added in v0.17.0

Delete deletes a widget.

func (*BabeldeskWidgetsResource) Get added in v0.17.0

Get returns a widget by id.

func (*BabeldeskWidgetsResource) List added in v0.17.0

List returns an iterator over widgets, auto-paginating across pages.

func (*BabeldeskWidgetsResource) ListAll added in v0.17.0

ListAll collects every widget into a slice (convenience over List).

func (*BabeldeskWidgetsResource) Update added in v0.17.0

Update updates a widget.

type BusinessHoursResource added in v0.17.0

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

BusinessHoursResource is the business-hours namespace (/api/v2/business-hours).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*BusinessHoursResource) AddRanges added in v0.38.0

AddRanges adds weekly time ranges to a business-hours definition.

func (*BusinessHoursResource) BulkDelete added in v0.38.0

BulkDelete deletes the given business-hours definitions by id.

func (*BusinessHoursResource) BulkUpdate added in v0.38.0

BulkUpdate applies the given updates to multiple business-hours definitions at once.

func (*BusinessHoursResource) Create added in v0.17.0

Create creates a business-hours definition.

func (*BusinessHoursResource) Delete added in v0.17.0

func (r *BusinessHoursResource) Delete(ctx context.Context, id string) error

Delete deletes a business-hours definition.

func (*BusinessHoursResource) Get added in v0.17.0

Get returns a business-hours definition by id.

func (*BusinessHoursResource) GetRange added in v0.38.0

GetRange returns a single weekly time range of a business-hours definition by id.

func (*BusinessHoursResource) List added in v0.17.0

List returns an iterator over business-hours definitions, auto-paginating across pages.

func (*BusinessHoursResource) ListAll added in v0.17.0

ListAll collects every business-hours definition into a slice (convenience over List).

func (*BusinessHoursResource) ListRanges added in v0.38.0

ListRanges returns the weekly time ranges of a business-hours definition.

func (*BusinessHoursResource) RemoveRange added in v0.38.0

RemoveRange removes a weekly time range from a business-hours definition.

func (*BusinessHoursResource) Update added in v0.17.0

Update updates a business-hours definition.

type CalendarsResource added in v0.17.0

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

CalendarsResource is the calendars namespace (/api/v2/calendars), with calendar dates.

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*CalendarsResource) AddDate added in v0.17.0

AddDate adds a date to a calendar.

func (*CalendarsResource) BulkDelete added in v0.38.0

BulkDelete deletes the given calendars by id.

func (*CalendarsResource) BulkUpdate added in v0.38.0

BulkUpdate applies the given updates to multiple calendars at once.

func (*CalendarsResource) Create added in v0.17.0

Create creates a calendar.

func (*CalendarsResource) Delete added in v0.17.0

func (r *CalendarsResource) Delete(ctx context.Context, id string) error

Delete deletes a calendar.

func (*CalendarsResource) Get added in v0.17.0

Get returns a calendar by id.

func (*CalendarsResource) GetDate added in v0.38.0

GetDate returns a single calendar date by id.

func (*CalendarsResource) GetDates added in v0.17.0

GetDates returns a calendar's dates.

func (*CalendarsResource) List added in v0.17.0

List returns an iterator over calendars, auto-paginating across pages.

func (*CalendarsResource) ListAll added in v0.17.0

ListAll collects every calendar into a slice (convenience over List).

func (*CalendarsResource) RemoveDate added in v0.38.0

RemoveDate removes a date from a calendar.

func (*CalendarsResource) TestDate added in v0.38.0

TestDate evaluates the calendars against a date (defaults to now when date is nil).

func (*CalendarsResource) Update added in v0.17.0

Update updates a calendar.

func (*CalendarsResource) UpdateDate added in v0.38.0

UpdateDate updates a calendar date by id.

type CallsResource added in v0.3.0

type CallsResource struct {
	// Reporting is the call-reporting sub-namespace (/api/v2/calls/reporting).
	Reporting *ReportingResource
	// contains filtered or unexported fields
}

CallsResource is the call namespace (/api/v2/calls): call reporting plus call control.

func (*CallsResource) Cancel added in v0.38.0

Cancel cancels a queued or ringing call and returns the updated call.

func (*CallsResource) CreateTestCall added in v0.17.0

CreateTestCall creates an inbound test call.

func (*CallsResource) Get added in v0.17.0

Get returns a single call by id.

func (*CallsResource) Hangup added in v0.17.0

Hangup hangs up a live call and returns the updated call.

func (*CallsResource) ListQueued added in v0.38.0

ListQueued returns an iterator over the calls currently queued in a queue, auto-paginating across pages. The Page field is managed by the auto-paginator, so leave it unset.

func (*CallsResource) QueueCallback added in v0.38.0

QueueCallback enqueues a callback in a queue and returns the queued callback.

func (*CallsResource) SetSessionVariables added in v0.17.0

SetSessionVariables sets session variables on a call.

type CampaignsResource added in v0.17.0

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

CampaignsResource is the outbound-campaigns namespace (/api/v2/outbound/campaigns).

func (*CampaignsResource) Attempts added in v0.38.0

Attempts lists the dialing attempts for a campaign.

func (*CampaignsResource) Create added in v0.17.0

Create creates a campaign.

func (*CampaignsResource) Delete added in v0.17.0

func (r *CampaignsResource) Delete(ctx context.Context, id string) error

Delete deletes a campaign.

func (*CampaignsResource) Get added in v0.17.0

Get returns a campaign by id.

func (*CampaignsResource) GetList added in v0.38.0

GetList returns the lead list assigned to a campaign.

func (*CampaignsResource) Hopper added in v0.38.0

Hopper returns the hopper (next leads to dial) for a campaign.

func (*CampaignsResource) Leads added in v0.38.0

Leads lists the leads of a campaign.

func (*CampaignsResource) List added in v0.17.0

List returns all outbound campaigns.

func (*CampaignsResource) LogoutAllAgents added in v0.38.0

LogoutAllAgents logs out all agents from a campaign.

func (*CampaignsResource) ProcessedLeads added in v0.38.0

ProcessedLeads lists the already-processed leads of a campaign.

func (*CampaignsResource) SetList added in v0.38.0

SetList assigns a lead list to a campaign.

func (*CampaignsResource) SetListById added in v0.38.0

func (r *CampaignsResource) SetListById(ctx context.Context, id string, listID string) (*managerapi.CampaignItemResponse, error)

SetListById assigns a lead list to a campaign by list id.

func (*CampaignsResource) Statistics added in v0.38.0

Statistics returns aggregated statistics for a campaign.

func (*CampaignsResource) Status added in v0.38.0

Status returns the realtime status of a campaign.

func (*CampaignsResource) UnsetList added in v0.38.0

UnsetList removes the lead list assigned to a campaign.

func (*CampaignsResource) Update added in v0.17.0

Update updates a campaign.

type ConferencesResource added in v0.17.0

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

ConferencesResource is the conferences namespace (/api/v2/conferences).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*ConferencesResource) Get added in v0.17.0

Get returns a single conference by id.

func (*ConferencesResource) List added in v0.17.0

List returns an iterator over conferences, auto-paginating across pages.

func (*ConferencesResource) ListAll added in v0.17.0

ListAll collects every conference into a slice (convenience over List).

type ConversationsResource added in v0.17.0

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

ConversationsResource is the conversations namespace (/api/v2/conversations), with events and session variables.

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*ConversationsResource) AddEvent added in v0.38.0

AddEvent appends an event to a conversation.

func (*ConversationsResource) AllEvents added in v0.38.0

AllEvents returns an iterator over events across all conversations, auto-paginating across pages.

Params takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*ConversationsResource) Close added in v0.38.0

Close closes a conversation.

func (*ConversationsResource) Create added in v0.17.0

Create creates a conversation.

func (*ConversationsResource) Delete added in v0.17.0

func (r *ConversationsResource) Delete(ctx context.Context, id string) error

Delete deletes a conversation.

func (*ConversationsResource) Events added in v0.17.0

func (r *ConversationsResource) Events(ctx context.Context, conversationID string) ([]managerapi.ConversationEvent, error)

Events returns a conversation's events.

func (*ConversationsResource) FirstEvent added in v0.38.0

FirstEvent returns a conversation's first event.

func (*ConversationsResource) Get added in v0.17.0

Get returns a conversation by id.

func (*ConversationsResource) GetSession added in v0.17.0

GetSession returns a conversation's session variables.

func (*ConversationsResource) LatestEvent added in v0.38.0

LatestEvent returns a conversation's latest event.

func (*ConversationsResource) List added in v0.17.0

List returns an iterator over conversations, auto-paginating across pages.

func (*ConversationsResource) ListAll added in v0.17.0

ListAll collects every conversation into a slice (convenience over List).

func (*ConversationsResource) Open added in v0.38.0

Open opens (reactivates) a conversation.

func (*ConversationsResource) Update added in v0.17.0

Update updates a conversation.

func (*ConversationsResource) UpdateSession added in v0.17.0

UpdateSession updates a conversation's session variables.

type DashboardsResource added in v0.38.0

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

DashboardsResource is the reporting-dashboards namespace (/api/v2/dashboards).

func (*DashboardsResource) AddUser added in v0.38.0

AddUser grants a user (by email) access to a dashboard.

func (*DashboardsResource) Create added in v0.38.0

Create creates a dashboard.

func (*DashboardsResource) Delete added in v0.38.0

func (r *DashboardsResource) Delete(ctx context.Context, id string) error

Delete deletes a dashboard by id.

func (*DashboardsResource) Get added in v0.38.0

Get returns a dashboard by id.

func (*DashboardsResource) List added in v0.38.0

List returns an iterator over dashboards, auto-paginating across pages. The Page field of params is managed by the iterator; any other filters (Q, Uuid, Sort, Order, Max) are honoured.

for dashboard, err := range mgr.Dashboards.List(ctx, managerapi.ListDashboardsParams{}) {
    if err != nil { return err }
    fmt.Println(dashboard.Name)
}

func (*DashboardsResource) ListAll added in v0.38.0

ListAll collects every dashboard into a slice (convenience over List).

func (*DashboardsResource) ListUsers added in v0.38.0

ListUsers lists the users allowed to access a dashboard.

func (*DashboardsResource) RemoveUser added in v0.38.0

RemoveUser revokes a user's (by id) access to a dashboard.

func (*DashboardsResource) Update added in v0.38.0

Update updates a dashboard.

type DialerBehavioursResource added in v0.38.0

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

DialerBehavioursResource is the dialer-behaviours namespace (/api/v2/outbound/dialer-behaviours).

func (*DialerBehavioursResource) Create added in v0.38.0

Create creates a dialer behaviour.

func (*DialerBehavioursResource) Delete added in v0.38.0

Delete deletes a dialer behaviour by id.

func (*DialerBehavioursResource) Get added in v0.38.0

Get returns a dialer behaviour by id.

func (*DialerBehavioursResource) List added in v0.38.0

List returns an iterator over dialer behaviours, auto-paginating across pages.

func (*DialerBehavioursResource) ListAll added in v0.38.0

ListAll collects every dialer behaviour into a slice (convenience over List).

func (*DialerBehavioursResource) Update added in v0.38.0

Update updates a dialer behaviour.

type DialerResource added in v0.38.0

type DialerResource struct {

	// Behaviours is the dialer-behaviours sub-namespace (/api/v2/outbound/dialer-behaviours).
	Behaviours *DialerBehavioursResource
	// contains filtered or unexported fields
}

DialerResource is the dialer namespace (/api/v2/dialer): runtime info, queue control, simple call reporting, plus the dialer-behaviours sub-namespace.

func (*DialerResource) Flush added in v0.38.0

Flush flushes queued dialer tasks. Pass a task id to flush a single task, or all=true to flush every queued task.

func (*DialerResource) Info added in v0.38.0

Info returns the current dialer runtime information.

func (*DialerResource) SimpleReporting added in v0.38.0

SimpleReporting returns an iterator over the dialer's simple call report (/api/v2/calls/reporting/simple/dialer), auto-paginating across pages.

for call, err := range mgr.Dialer.SimpleReporting(ctx, managerapi.ListDialerSimpleReportingCallsParams{}) {
    if err != nil { return err }
    fmt.Println(call.Id)
}

func (*DialerResource) SimpleReportingAll added in v0.38.0

SimpleReportingAll collects every call from the dialer's simple report into a slice (convenience over SimpleReporting).

type EventsResource added in v0.17.0

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

EventsResource is the events namespace (/api/v2/events): event definitions and custom events.

func (*EventsResource) CreateCustom added in v0.17.0

CreateCustom creates a custom event.

func (*EventsResource) DeleteCustom added in v0.17.0

func (r *EventsResource) DeleteCustom(ctx context.Context, id string) error

DeleteCustom deletes a custom event.

func (*EventsResource) List added in v0.17.0

func (r *EventsResource) List(ctx context.Context) ([]managerapi.Event, error)

List returns the available event definitions.

type ExpressionsResource added in v0.17.0

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

ExpressionsResource is the expressions namespace (/api/v2/expressions): catalog and evaluation.

func (*ExpressionsResource) Evaluate added in v0.17.0

Evaluate evaluates an expression against a sample context. async dispatches automations asynchronously.

func (*ExpressionsResource) List added in v0.17.0

List returns the available expressions.

type FilesResource added in v0.38.0

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

FilesResource is the stored-files namespace (/api/v2/files) — listing, fetching, downloading, and (bulk) deleting stored files (recordings, prompts, backups, …).

func (*FilesResource) Backups added in v0.38.0

func (r *FilesResource) Backups(ctx context.Context) ([]managerapi.StoredFile, error)

Backups lists the account's backup files.

func (*FilesResource) BulkDelete added in v0.38.0

BulkDelete deletes several stored files by id.

func (*FilesResource) BulkDownload added in v0.38.0

func (r *FilesResource) BulkDownload(ctx context.Context, ids []string) ([]byte, error)

BulkDownload downloads several stored files as a ZIP (ids passed as a query parameter).

func (*FilesResource) BulkDownloadPost added in v0.38.0

func (r *FilesResource) BulkDownloadPost(ctx context.Context, ids []string) ([]byte, error)

BulkDownloadPost downloads several stored files as a ZIP (ids in the request body).

func (*FilesResource) Delete added in v0.38.0

Delete deletes a stored file by id.

func (*FilesResource) Download added in v0.38.0

func (r *FilesResource) Download(ctx context.Context, id string) ([]byte, error)

Download returns the raw bytes of a stored file.

func (*FilesResource) Get added in v0.38.0

Get returns a stored file's metadata by id.

func (*FilesResource) List added in v0.38.0

List returns an iterator over stored files, auto-paginating across pages. Page is managed by the iterator; other filters on params (Type, State, Filename, Q, Sort, Order, Max) are honoured.

func (*FilesResource) ListAll added in v0.38.0

ListAll collects every stored file into a slice (convenience over List).

func (*FilesResource) ListByType added in v0.38.0

func (r *FilesResource) ListByType(ctx context.Context, fileType managerapi.StorageType) ([]managerapi.StoredFile, error)

ListByType lists the stored files of a given storage type.

func (*FilesResource) Prompts added in v0.38.0

func (r *FilesResource) Prompts(ctx context.Context) ([]managerapi.StoredFile, error)

Prompts lists the account's prompt files.

func (*FilesResource) Recordings added in v0.38.0

func (r *FilesResource) Recordings(ctx context.Context) ([]managerapi.StoredFile, error)

Recordings lists the account's recording files.

type IntegrationsResource added in v0.17.0

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

IntegrationsResource is the integrations namespace (/api/v2/integrations).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*IntegrationsResource) APIProxyGet added in v0.38.0

func (r *IntegrationsResource) APIProxyGet(ctx context.Context, integrationID, uri string) ([]byte, error)

APIProxyGet proxies a GET request to an integration's upstream API and returns the raw response body.

func (*IntegrationsResource) APIProxyPost added in v0.38.0

func (r *IntegrationsResource) APIProxyPost(ctx context.Context, integrationID, uri string, body map[string]any) ([]byte, error)

APIProxyPost proxies a POST request to an integration's upstream API and returns the raw response body.

func (*IntegrationsResource) ActionVariables added in v0.17.0

ActionVariables lists the variables a single provider action exposes.

func (*IntegrationsResource) AddAssociation added in v0.17.0

func (r *IntegrationsResource) AddAssociation(ctx context.Context, integrationID, associationID, actionName string) (*managerapi.IntegrationAddAssociationResponse, error)

AddAssociation associates an integration action with an object.

func (*IntegrationsResource) Authorize added in v0.38.0

Authorize completes the authorization step for an integration.

func (*IntegrationsResource) Available added in v0.17.0

Available lists the integration providers available to this account.

func (*IntegrationsResource) BulkDelete added in v0.38.0

BulkDelete deletes several integrations by id.

func (*IntegrationsResource) BulkUpdate added in v0.38.0

BulkUpdate updates several integrations in one request.

func (*IntegrationsResource) Clone added in v0.38.0

Clone clones an existing integration.

func (*IntegrationsResource) Create added in v0.17.0

Create creates an integration.

func (*IntegrationsResource) Delete added in v0.17.0

func (r *IntegrationsResource) Delete(ctx context.Context, id string) error

Delete deletes an integration.

func (*IntegrationsResource) DeleteToken added in v0.38.0

DeleteToken deletes an integration token by id.

func (*IntegrationsResource) DispatchAction added in v0.17.0

DispatchAction dispatches an integration action.

func (*IntegrationsResource) DispatchActionGet added in v0.38.0

DispatchActionGet dispatches an integration action via GET, optionally scoped to a call or session.

func (*IntegrationsResource) DispatchTypeAction added in v0.38.0

func (r *IntegrationsResource) DispatchTypeAction(ctx context.Context, typ, id, action string, body map[string]any) (*map[string]any, error)

DispatchTypeAction dispatches an action on an integration by type.

func (*IntegrationsResource) ExecuteAction added in v0.38.0

func (r *IntegrationsResource) ExecuteAction(ctx context.Context, actionType, actionName string, body map[string]any) (*managerapi.DefaultV2MessageResponse, error)

ExecuteAction executes an action by type and name with a free-form request body.

func (*IntegrationsResource) Get added in v0.17.0

Get returns an integration by id.

func (*IntegrationsResource) GetToken added in v0.38.0

GetToken returns a single integration token by id.

func (*IntegrationsResource) Integrate added in v0.38.0

Integrate runs the integrate step for an integration.

func (*IntegrationsResource) List added in v0.17.0

List returns an iterator over configured integrations, auto-paginating across pages.

func (*IntegrationsResource) ListActionParams added in v0.38.0

func (r *IntegrationsResource) ListActionParams(ctx context.Context, providerName, providerActionName string) (*managerapi.ObjectListResponse, error)

ListActionParams lists the parameters a single provider action accepts.

func (*IntegrationsResource) ListActions added in v0.38.0

ListActions lists the actions available across providers, optionally filtered by type.

func (*IntegrationsResource) ListAll added in v0.17.0

ListAll collects every integration into a slice (convenience over List).

func (*IntegrationsResource) ListTokens added in v0.38.0

ListTokens lists the OAuth tokens stored for an integration.

ProviderLogo returns a provider's logo at a given size.

func (*IntegrationsResource) ProviderSessionVariables added in v0.17.0

ProviderSessionVariables lists the session variables a provider's actions expose.

func (*IntegrationsResource) ProviderTemplate added in v0.38.0

func (r *IntegrationsResource) ProviderTemplate(ctx context.Context, provider string) (*map[string]any, error)

ProviderTemplate returns the configuration template for a provider.

func (*IntegrationsResource) Providers added in v0.38.0

Providers lists the integration providers known to the manager.

func (*IntegrationsResource) RefreshToken added in v0.38.0

RefreshToken refreshes an integration token by id.

func (*IntegrationsResource) RemoveAssociation added in v0.17.0

func (r *IntegrationsResource) RemoveAssociation(ctx context.Context, integrationID, associationID, actionName string) (*managerapi.IntegrationRemoveAssociationResponse, error)

RemoveAssociation removes an integration action association.

func (*IntegrationsResource) Template added in v0.38.0

func (r *IntegrationsResource) Template(ctx context.Context, typ, provider string) (*map[string]any, error)

Template returns the configuration template for a given type and provider.

func (*IntegrationsResource) TypeActions added in v0.38.0

TypeActions lists the actions available for an integration type.

func (*IntegrationsResource) Update added in v0.17.0

Update updates an integration.

type InterruptTarget added in v0.2.0

InterruptTarget is the state a manager-interrupt transitions a task to.

type ListAgentsQuery added in v0.3.0

type ListAgentsQuery struct {
	// Q searches name, group name, number, email, sourceId and integration label at once.
	Q *string
	// Enabled restricts to enabled (true) or disabled (false) agents.
	Enabled *bool
	// Name filters by agent name.
	Name *string
	// Number filters by the agent's number.
	Number *string
	// SourceId filters by integration source id.
	SourceId *string
	// State filters by line status.
	State *managerapi.AgentLineStatus
	// Source filters by source integration.
	Source *string
	// GroupIds restricts to agents in these group id(s).
	GroupIds []string
	// PageSize is the page size (the API's max). Zero uses the server default.
	PageSize int
}

ListAgentsQuery filters an agent listing.

type ListApplicationsQuery added in v0.4.0

type ListApplicationsQuery struct {
	// PageSize is the page size (the API's max). Zero uses the server default.
	PageSize int
}

ListApplicationsQuery filters an application listing.

type ListTasksQuery added in v0.2.0

type ListTasksQuery struct {
	// Filter is a server-side filter expression.
	Filter *string
	// PageSize is the page size (1..100); defaults to 100.
	PageSize int
}

ListTasksQuery filters a task listing.

type ListUsersQuery

type ListUsersQuery struct {
	// Email filters by email address.
	Email *string
}

ListUsersQuery filters a user listing.

type LogsResource added in v0.17.0

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

LogsResource is the logs namespace: request audit logs (/api/v2/audit) and live logs (/api/v2/logs).

func (*LogsResource) Audit added in v0.17.0

Audit returns an iterator over request audit-log entries, auto-paginating across pages.

func (*LogsResource) AuditAll added in v0.17.0

AuditAll collects every audit-log entry into a slice (convenience over Audit).

func (*LogsResource) DisableLive added in v0.38.0

DisableLive turns off live logging and returns the acknowledgement message.

func (*LogsResource) EnableLive added in v0.38.0

EnableLive turns on live logging and returns the acknowledgement message.

func (*LogsResource) Live added in v0.17.0

func (r *LogsResource) Live(ctx context.Context) ([]managerapi.LiveLog, error)

Live returns the current live logs.

func (*LogsResource) Write added in v0.38.0

Write appends an entry to the live log and returns the created item.

type ManagerClient

type ManagerClient struct {
	// Users is the user-management namespace (/api/v2/users).
	Users *UsersResource
	// Me is the authenticated-principal namespace (/api/v2/user): current user, accounts.
	Me *MeResource
	// Agents is the agent-management namespace (/api/v2/agents).
	Agents *AgentsResource
	// Calls is the call namespace (/api/v2/calls): reporting and call control.
	Calls *CallsResource
	// Sms is the SMS-records namespace (/api/v2/sms).
	Sms *SmsResource
	// Numbers is the service-numbers namespace (/api/v2/numbers).
	Numbers *NumbersResource
	// Conferences is the conferences namespace (/api/v2/conferences).
	Conferences *ConferencesResource
	// Queues is the queues namespace (/api/v2/queues), including selections.
	Queues *QueuesResource
	// Routing is the routing-rules namespace (/api/v2/routings).
	Routing *RoutingResource
	// Triggers is the workflow-triggers namespace (/api/v2/triggers).
	Triggers *TriggersResource
	// Automations is the global-automations namespace (/api/v2/events/triggers).
	Automations *AutomationsResource
	// Integrations is the integrations namespace (/api/v2/integrations).
	Integrations *IntegrationsResource
	// Outbound is the outbound dialer-lists namespace (/api/v2/outbound/lists).
	Outbound *OutboundResource
	// Dialer is the dialer namespace (/api/v2/dialer): runtime info, queue control,
	// simple reporting and behaviours.
	Dialer *DialerResource
	// Phonebook is the phonebook-entries namespace (/api/v2/phonebook).
	Phonebook *PhonebookResource
	// Campaigns is the outbound-campaigns namespace (/api/v2/outbound/campaigns).
	Campaigns *CampaignsResource
	// BusinessHours is the business-hours namespace (/api/v2/business-hours).
	BusinessHours *BusinessHoursResource
	// Calendars is the calendars namespace (/api/v2/calendars).
	Calendars *CalendarsResource
	// Conversations is the conversations namespace (/api/v2/conversations).
	Conversations *ConversationsResource
	// Sessions is the call/automation-sessions namespace (/api/v2/sessions).
	Sessions *SessionsResource
	// Prompts is the audio-prompts namespace (/api/v2/prompts).
	Prompts *PromptsResource
	// Babeldesk is the babeldesk namespace (/api/v2/babeldesk): dashboards and widgets.
	Babeldesk *BabeldeskResource
	// Dashboards is the reporting-dashboards namespace (/api/v2/dashboards).
	Dashboards *DashboardsResource
	// Files is the stored-files namespace (/api/v2/files).
	Files *FilesResource
	// Recordings is the call-recordings namespace (/api/v2/recordings).
	Recordings *RecordingsResource
	// Events is the events namespace (/api/v2/events): definitions and custom events.
	Events *EventsResource
	// Logs is the logs namespace: request audit logs (/api/v2/audit) and live logs (/api/v2/logs).
	Logs *LogsResource
	// Expressions is the expressions namespace (/api/v2/expressions): catalog and evaluation.
	Expressions *ExpressionsResource
	// Metrics is the metrics namespace (/api/v2/metrics).
	Metrics *MetricsResource
	// System is the system/reference namespace: health checks (/api/v2/echo, /api/v2/ping,
	// /api/v2/status), server time and timezones (/api/v2/data), push tokens (/api/v2/push-token),
	// tags (/api/v2/tags), and template exports (/api/v2/templates/export).
	System *SystemResource
	// Applications is the application (IVR) management namespace (/api/v2/applications).
	Applications *ApplicationsResource
	// Settings is the global-settings namespace (/api/v2/settings).
	Settings *SettingsResource
	// Tasks is the task-automation namespace (/api/v3/tasks).
	Tasks *TasksResource
	// Auth is the OAuth 2.0 namespace (/oauth): authorize, token, and revoke. These endpoints
	// authenticate via OAuth client credentials in the request, independent of [Options.Auth].
	Auth *AuthResource
}

ManagerClient is the babelforce manager SDK client. Create one with Connect.

func Connect

func Connect(_ context.Context, opts Options) (*ManagerClient, error)

Connect creates and configures a client.

type MeResource added in v0.17.0

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

MeResource is the authenticated-principal namespace (/api/v2/user): the current user, the accounts they can access, and self-service password reset.

func (*MeResource) Accounts added in v0.17.0

func (r *MeResource) Accounts(ctx context.Context) ([]userapi.Account, error)

Accounts lists the accounts the current user can access.

func (*MeResource) Customer added in v0.17.0

Customer returns the current user together with their account (customer) information.

func (*MeResource) Get added in v0.17.0

Get returns the current user.

func (*MeResource) ResetPassword added in v0.17.0

func (r *MeResource) ResetPassword(ctx context.Context) error

ResetPassword requests a password-reset email for the current user.

type MetricsResource added in v0.3.0

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

MetricsResource is the metrics namespace (/api/v2/metrics).

func (*MetricsResource) Definitions added in v0.38.0

Definitions returns the definitions for every available metric (GET /api/v2/metrics/describe).

func (*MetricsResource) Describe added in v0.3.0

Describe returns a metric's definition by id.

func (*MetricsResource) Get added in v0.3.0

Get returns a metric's current value by id.

func (*MetricsResource) ListIds added in v0.3.0

ListIds lists the available metric ids.

type NumbersResource added in v0.17.0

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

NumbersResource is the service-numbers namespace (/api/v2/numbers).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*NumbersResource) AddTags added in v0.17.0

AddTags adds tags to a service number and returns the updated number.

func (*NumbersResource) Get added in v0.17.0

Get returns a single service number by id.

func (*NumbersResource) List added in v0.17.0

List returns an iterator over service numbers, auto-paginating across pages.

func (*NumbersResource) ListAll added in v0.17.0

ListAll collects every service number into a slice (convenience over List).

func (*NumbersResource) Update added in v0.38.0

Update updates a service number from a free-form body (the API accepts an arbitrary object).

type Options

type Options struct {
	// BaseURL is the base URL of the babelforce API. Defaults to [DefaultBaseURL].
	BaseURL string
	// Auth is how the client authenticates. Required.
	Auth Auth
	// HTTPClient is the underlying HTTP client. Defaults to http.DefaultClient.
	HTTPClient *http.Client
	// Retry tunes automatic retries. Nil uses sensible defaults (see [RetryPolicy]); set
	// &RetryPolicy{MaxRetries: 0} to disable.
	Retry *RetryPolicy
}

Options configures a ManagerClient.

type OutboundResource added in v0.17.0

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

OutboundResource is the outbound dialer-lists namespace (/api/v2/outbound/lists), with leads.

func (*OutboundResource) AddLead added in v0.17.0

AddLead adds a lead to an outbound list.

func (*OutboundResource) Attempts added in v0.38.0

Attempts returns an iterator over outbound call attempts, auto-paginating across pages. Page is managed by the iterator; leave params.Page unset.

Wraps generated ListOutboundAttempts.

func (*OutboundResource) AttemptsAll added in v0.38.0

AttemptsAll collects every outbound call attempt into a slice (convenience over Attempts).

func (*OutboundResource) BulkDeleteLeads added in v0.38.0

BulkDeleteLeads bulk-deletes leads from an outbound list.

Wraps generated BulkDeleteOutboundLeads.

func (*OutboundResource) BulkDeleteLeadsAlt added in v0.38.0

BulkDeleteLeadsAlt bulk-deletes leads from an outbound list via the alternate endpoint.

Wraps generated BulkDeleteOutboundLeadsAlt.

func (*OutboundResource) ClearList added in v0.17.0

ClearList removes all leads from an outbound list and returns the (now empty) list.

func (*OutboundResource) CreateAgentCall added in v0.38.0

CreateAgentCall starts an outbound call from an agent (by id) to a destination.

Wraps generated CreateAgentOutboundCall.

func (*OutboundResource) CreateList added in v0.17.0

CreateList creates an outbound list.

func (*OutboundResource) DeleteLead added in v0.17.0

func (r *OutboundResource) DeleteLead(ctx context.Context, listID, leadID string) error

DeleteLead removes a lead from an outbound list.

func (*OutboundResource) DeleteList added in v0.38.0

func (r *OutboundResource) DeleteList(ctx context.Context, id string) error

DeleteList deletes an outbound list by id.

Wraps generated DeleteOutboundList.

func (*OutboundResource) GetLead added in v0.38.0

func (r *OutboundResource) GetLead(ctx context.Context, listID, leadID string) (*managerapi.LeadItemResponse, error)

GetLead returns a single lead from an outbound list.

Wraps generated GetLeadInList.

func (*OutboundResource) GetList added in v0.38.0

GetList returns an outbound list by id.

Wraps generated GetOutboundList.

func (*OutboundResource) Leads added in v0.38.0

Leads returns an iterator over outbound leads, auto-paginating across pages. Page is managed by the iterator; leave params.Page unset.

Wraps generated ListOutboundLeads.

func (*OutboundResource) LeadsAll added in v0.38.0

LeadsAll collects every outbound lead into a slice (convenience over Leads).

func (*OutboundResource) ListLeads added in v0.38.0

ListLeads returns the leads of an outbound list (single page; optionally filtered by status).

Wraps generated ListLeadsInList.

func (*OutboundResource) Lists added in v0.17.0

Lists returns all outbound lists.

func (*OutboundResource) ProcessedLeads added in v0.38.0

ProcessedLeads returns an iterator over processed outbound leads, auto-paginating across pages. Page is managed by the iterator; leave params.Page unset.

Wraps generated ListProcessedOutboundLeads.

func (*OutboundResource) ProcessedLeadsAll added in v0.38.0

ProcessedLeadsAll collects every processed outbound lead into a slice (convenience over ProcessedLeads).

func (*OutboundResource) SimpleReporting added in v0.38.0

SimpleReporting returns an iterator over outbound simple-reporting calls, auto-paginating across pages. Page is managed by the iterator; leave params.Page unset.

Wraps generated ListOutboundSimpleReportingCalls.

func (*OutboundResource) SimpleReportingAll added in v0.38.0

SimpleReportingAll collects every outbound simple-reporting call into a slice (convenience over SimpleReporting).

func (*OutboundResource) UpdateLead added in v0.17.0

UpdateLead updates a lead in an outbound list.

func (*OutboundResource) UpdateList added in v0.38.0

UpdateList updates an outbound list by id.

Wraps generated UpdateOutboundList.

func (*OutboundResource) UploadLeads added in v0.38.0

func (r *OutboundResource) UploadLeads(ctx context.Context, id, filename string, file io.Reader, opts UploadLeadsOptions) (*managerapi.LeadUploadResponse, error)

UploadLeads imports leads into an outbound list from a CSV file (multipart upload). filename is the form file name (e.g. "leads.csv") and file streams the CSV contents.

Wraps generated UploadOutboundLeads.

type PhonebookResource added in v0.17.0

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

PhonebookResource is the phonebook-entries namespace (/api/v2/phonebook), with bulk CSV download/upload.

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*PhonebookResource) BulkDelete added in v0.38.0

BulkDelete deletes the given phonebook entries by id.

func (*PhonebookResource) Create added in v0.17.0

Create creates a phonebook entry.

func (*PhonebookResource) Delete added in v0.17.0

func (r *PhonebookResource) Delete(ctx context.Context, id string) error

Delete deletes a phonebook entry.

func (*PhonebookResource) Download added in v0.17.0

func (r *PhonebookResource) Download(ctx context.Context) ([]byte, error)

Download returns all phonebook entries as a raw CSV export (bulk).

func (*PhonebookResource) Get added in v0.17.0

Get returns a phonebook entry by id.

func (*PhonebookResource) List added in v0.17.0

List returns an iterator over phonebook entries, auto-paginating across pages.

func (*PhonebookResource) ListAll added in v0.17.0

ListAll collects every phonebook entry into a slice (convenience over List).

func (*PhonebookResource) Update added in v0.17.0

Update updates a phonebook entry.

func (*PhonebookResource) Upload added in v0.17.0

func (r *PhonebookResource) Upload(ctx context.Context, contentType string, body io.Reader) error

Upload imports phonebook entries from a CSV stream (bulk). contentType is e.g. "text/csv".

type PkceChallenge added in v0.40.0

type PkceChallenge struct {
	CodeVerifier        string
	CodeChallenge       string
	CodeChallengeMethod string // always "S256"
}

PkceChallenge is a PKCE code verifier + S256 challenge (RFC 7636).

func GeneratePKCE added in v0.40.0

func GeneratePKCE() (PkceChallenge, error)

GeneratePKCE returns a fresh PKCE verifier + S256 challenge. Pass CodeChallenge to BuildAuthorizeURL and keep CodeVerifier to exchange the returned code via AuthorizationCodeGrant.

type PromptsResource added in v0.17.0

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

PromptsResource is the audio-prompts namespace (/api/v2/prompts).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*PromptsResource) Delete added in v0.17.0

func (r *PromptsResource) Delete(ctx context.Context, id string) error

Delete deletes a prompt.

func (*PromptsResource) Get added in v0.17.0

Get returns a prompt by id.

func (*PromptsResource) List added in v0.17.0

List returns an iterator over prompts, auto-paginating across pages.

func (*PromptsResource) ListAll added in v0.17.0

ListAll collects every prompt into a slice (convenience over List).

func (*PromptsResource) Update added in v0.17.0

Update updates a prompt's metadata.

func (*PromptsResource) Upload added in v0.17.0

func (r *PromptsResource) Upload(ctx context.Context, contentType string, body io.Reader) (*managerapi.PromptItemResponse, error)

Upload uploads a new audio prompt from a stream. contentType is e.g. "audio/wav".

func (*PromptsResource) Uses added in v0.38.0

Uses lists the objects (e.g. applications) that reference a prompt (GET /api/v2/prompts/{id}/uses).

type QueueSelectionsResource added in v0.17.0

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

QueueSelectionsResource is queue selections (routing rules) and their agent/group/tag membership.

func (*QueueSelectionsResource) AddAgent added in v0.17.0

func (r *QueueSelectionsResource) AddAgent(ctx context.Context, queueID, selectionID, agentID string) (*managerapi.QueueSelectionModificationResponse, error)

AddAgent adds an agent to a selection.

func (*QueueSelectionsResource) AddGroup added in v0.17.0

func (r *QueueSelectionsResource) AddGroup(ctx context.Context, queueID, selectionID, groupID string) (*managerapi.QueueSelectionModificationResponse, error)

AddGroup adds an agent group to a selection.

func (*QueueSelectionsResource) AddTag added in v0.17.0

func (r *QueueSelectionsResource) AddTag(ctx context.Context, queueID, selectionID, tagID string) (*managerapi.QueueSelectionModificationResponse, error)

AddTag adds a tag to a selection.

func (*QueueSelectionsResource) Create added in v0.17.0

Create creates a selection on a queue.

func (*QueueSelectionsResource) Delete added in v0.17.0

func (r *QueueSelectionsResource) Delete(ctx context.Context, queueID, id string) error

Delete deletes a selection.

func (*QueueSelectionsResource) Get added in v0.17.0

Get returns a selection.

func (*QueueSelectionsResource) List added in v0.17.0

List returns an iterator over a queue's selections, auto-paginating across pages.

func (*QueueSelectionsResource) ListAll added in v0.17.0

ListAll collects every selection for a queue into a slice (convenience over List).

func (*QueueSelectionsResource) RemoveAgent added in v0.17.0

func (r *QueueSelectionsResource) RemoveAgent(ctx context.Context, queueID, selectionID, id string) (*managerapi.QueueSelectionModificationResponse, error)

RemoveAgent removes an agent from a selection.

func (*QueueSelectionsResource) RemoveGroup added in v0.17.0

func (r *QueueSelectionsResource) RemoveGroup(ctx context.Context, queueID, selectionID, id string) (*managerapi.QueueSelectionModificationResponse, error)

RemoveGroup removes an agent group from a selection.

func (*QueueSelectionsResource) RemoveTag added in v0.17.0

func (r *QueueSelectionsResource) RemoveTag(ctx context.Context, queueID, selectionID, id string) (*managerapi.QueueSelectionModificationResponse, error)

RemoveTag removes a tag from a selection.

func (*QueueSelectionsResource) SelectAgents added in v0.17.0

SelectAgents resolves the agents currently selected for a queue.

func (*QueueSelectionsResource) SetPriority added in v0.38.0

SetPriority sets the priority of the given selections on a queue.

func (*QueueSelectionsResource) Update added in v0.17.0

Update updates a selection.

type QueuesResource added in v0.17.0

type QueuesResource struct {

	// Selections is the queue-selections sub-namespace (/api/v2/queues/{queueId}/selections).
	Selections *QueueSelectionsResource
	// contains filtered or unexported fields
}

QueuesResource is the queues namespace (/api/v2/queues), with a nested Selections sub-resource.

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*QueuesResource) BulkUpdate added in v0.38.0

BulkUpdate updates multiple queues in a single request (each item must include its id).

func (*QueuesResource) Create added in v0.17.0

Create creates a queue.

func (*QueuesResource) Delete added in v0.17.0

func (r *QueuesResource) Delete(ctx context.Context, id string) error

Delete deletes a queue.

func (*QueuesResource) Get added in v0.17.0

Get returns a queue by id.

func (*QueuesResource) GlobalSelections added in v0.38.0

GlobalSelections lists queue selections across all queues.

func (*QueuesResource) List added in v0.17.0

List returns an iterator over queues, auto-paginating across pages.

func (*QueuesResource) ListAll added in v0.17.0

ListAll collects every queue into a slice (convenience over List).

func (*QueuesResource) ListTriggers added in v0.38.0

func (r *QueuesResource) ListTriggers(ctx context.Context, queueID string) (*managerapi.QueueTriggerListResponse, error)

ListTriggers lists the triggers attached to a queue.

func (*QueuesResource) Update added in v0.17.0

Update updates a queue.

type RecordingsResource added in v0.38.0

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

RecordingsResource is the call-recordings namespace (/api/v2/recordings): listing, starting, fetching, updating, deleting, bulk actions and flagging of call recordings.

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*RecordingsResource) BulkAction added in v0.38.0

func (r *RecordingsResource) BulkAction(ctx context.Context, action string, ids []string) (*managerapi.BulkActionResponse, error)

BulkAction applies a bulk action (e.g. "delete", "flag") to several recordings by id.

func (*RecordingsResource) Delete added in v0.38.0

func (r *RecordingsResource) Delete(ctx context.Context, id string) error

Delete deletes a recording by id.

func (*RecordingsResource) Flag added in v0.38.0

Flag flags a recording by id.

func (*RecordingsResource) Get added in v0.38.0

Get returns a recording by id.

func (*RecordingsResource) GetFlag added in v0.38.0

GetFlag returns a recording's flag state by id.

func (*RecordingsResource) List added in v0.38.0

List returns an iterator over recordings, auto-paginating across pages.

for rec, err := range mgr.Recordings.List(ctx, managerapi.ListRecordingsParams{}) {
    if err != nil { return err }
    fmt.Println(rec.Id)
}

func (*RecordingsResource) ListAll added in v0.38.0

ListAll collects every recording into a slice (convenience over List).

func (*RecordingsResource) Start added in v0.38.0

Start starts a recording for a call.

func (*RecordingsResource) ToggleFlag added in v0.38.0

ToggleFlag toggles the flag on a recording by id.

func (*RecordingsResource) Unflag added in v0.38.0

Unflag removes the flag from a recording by id.

func (*RecordingsResource) Update added in v0.38.0

Update updates a recording (e.g. its tags) by id.

type ReportingResource added in v0.3.0

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

ReportingResource is the call-reporting namespace (/api/v2/calls/reporting).

The list methods take the generated parameter structs directly (every filter is an optional pointer field); the Page field is managed by the auto-paginator, so leave it unset.

func (*ReportingResource) InboundSimple added in v0.38.0

InboundSimple returns an iterator over the simple inbound call report (/api/v2/calls/reporting/simple/inbound), auto-paginating across pages.

func (*ReportingResource) InboundSimpleAll added in v0.38.0

InboundSimpleAll collects every call from the simple inbound report into a slice (convenience over InboundSimple).

func (*ReportingResource) List added in v0.3.0

List returns an iterator over the detailed call report, auto-paginating across pages.

for call, err := range mgr.Calls.Reporting.List(ctx, managerapi.ListReportingCallsParams{}) {
    if err != nil { return err }
    fmt.Println(call.Id)
}

func (*ReportingResource) ListAll added in v0.3.0

ListAll collects every call from the detailed report into a slice (convenience over List).

func (*ReportingResource) Simple added in v0.3.0

Simple returns an iterator over the simple call report across all report types (/api/v2/calls/reporting/simple), auto-paginating across pages.

func (*ReportingResource) SimpleAll added in v0.3.0

SimpleAll collects every call from the simple report into a slice (convenience over Simple).

type RetentionSettings added in v0.4.0

RetentionSettings groups the `retention` settings.

type RetryPolicy added in v0.17.0

type RetryPolicy struct {
	// MaxRetries is the number of retry attempts after the initial request. Default 2; 0 disables.
	MaxRetries int
	// BaseDelay is the base backoff; it grows exponentially per attempt. Default 250ms.
	BaseDelay time.Duration
	// MaxDelay caps any single backoff and also caps Retry-After. Default 10s.
	MaxDelay time.Duration
	// RetryStatus is the set of response status codes that trigger a retry.
	// Default: 429, 502, 503, 504.
	RetryStatus []int
}

RetryPolicy tunes automatic request retries. Transient failures — network errors and a small set of "try again" status codes (429/502/503/504 by default) — are retried with exponential backoff and jitter, honouring a Retry-After header when present.

Retries are on by default with conservative settings (see Connect). To customise, set Options.Retry; zero-valued delay/status fields fall back to the defaults, but MaxRetries is taken literally — set it to 0 to disable retries.

type RoutingResource added in v0.17.0

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

RoutingResource is the routing-rules namespace (/api/v2/routings).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*RoutingResource) Create added in v0.17.0

Create creates a routing.

func (*RoutingResource) Delete added in v0.17.0

func (r *RoutingResource) Delete(ctx context.Context, id string) error

Delete deletes a routing.

func (*RoutingResource) Get added in v0.17.0

Get returns a routing by id.

func (*RoutingResource) List added in v0.17.0

List returns an iterator over routings, auto-paginating across pages.

func (*RoutingResource) ListAll added in v0.17.0

ListAll collects every routing into a slice (convenience over List).

func (*RoutingResource) Update added in v0.17.0

Update updates a routing.

type SessionsResource added in v0.17.0

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

SessionsResource is the call/automation sessions namespace (/api/v2/sessions).

func (*SessionsResource) Create added in v0.17.0

Create creates a new session.

func (*SessionsResource) Get added in v0.17.0

Get returns a session (its variables) by id.

func (*SessionsResource) UpdateVariables added in v0.17.0

UpdateVariables updates a session's variables.

type Setting added in v0.4.0

type Setting[TGet any, TUpd any] struct {
	// contains filtered or unexported fields
}

Setting is one global-settings group: read its full value with Get, replace it with Update. TGet is the returned value type; TUpd is the (partial, all-optional) update payload type.

func (Setting[TGet, TUpd]) Get added in v0.4.0

func (s Setting[TGet, TUpd]) Get(ctx context.Context) (*TGet, error)

Get reads the current value of this settings group.

func (Setting[TGet, TUpd]) Update added in v0.4.0

func (s Setting[TGet, TUpd]) Update(ctx context.Context, data TUpd) (*TGet, error)

Update replaces this settings group and returns the new value.

type SettingsResource added in v0.4.0

type SettingsResource struct {
	App       AppSettings
	Telephony TelephonySettings
	Audit     AuditSettings
	Ui        UiSettings
	Retention RetentionSettings
	// contains filtered or unexported fields
}

SettingsResource is the global-settings namespace (/api/v2/settings), grouped by scope.

The typed section accessors (App, Telephony, …) read and replace individual scope/key groups. The generic methods (ListAll, ListInScope, Clear, ClearInScope, ClearAll) operate across the whole settings collection or an entire scope at once.

func (*SettingsResource) Clear added in v0.38.0

Clear resets a single setting to its default and returns the cleared item (DELETE /api/v2/settings/{scope}/{key}).

func (*SettingsResource) ClearAll added in v0.38.0

ClearAll resets every customer setting across all scopes to its default and returns the remaining list (DELETE /api/v2/settings).

func (*SettingsResource) ClearInScope added in v0.38.0

ClearInScope resets every setting in a scope to its default and returns the remaining list (DELETE /api/v2/settings/{scope}).

func (*SettingsResource) ListAll added in v0.38.0

ListAll lists every customer setting across all scopes (GET /api/v2/settings).

func (*SettingsResource) ListInScope added in v0.38.0

ListInScope lists every customer setting in a scope (GET /api/v2/settings/{scope}).

type SmsResource added in v0.17.0

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

SmsResource is the SMS-records namespace (/api/v2/sms).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*SmsResource) Delete added in v0.38.0

Delete deletes an SMS record by id, returning the deleted record.

func (*SmsResource) Get added in v0.17.0

Get returns a single SMS record by id.

func (*SmsResource) List added in v0.17.0

List returns an iterator over SMS records, auto-paginating across pages.

func (*SmsResource) ListAll added in v0.17.0

func (r *SmsResource) ListAll(ctx context.Context, params managerapi.ListSmssParams) ([]managerapi.Sms, error)

ListAll collects every SMS record into a slice (convenience over List).

func (*SmsResource) Report added in v0.38.0

Report returns an iterator over the SMS reporting records, auto-paginating across pages.

Params takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*SmsResource) Send added in v0.38.0

Send sends an SMS message.

func (*SmsResource) TestInbound added in v0.38.0

TestInbound simulates an inbound SMS message for testing.

type SystemResource added in v0.38.0

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

SystemResource is the system/reference namespace: health checks, server time, timezones, push tokens, tags, and template exports.

func (*SystemResource) ApiStatus added in v0.38.0

ApiStatus returns the API status (/api/v2/status).

func (*SystemResource) Echo added in v0.38.0

Echo returns the request echoed back (/api/v2/echo).

func (*SystemResource) ExportTemplates added in v0.38.0

func (r *SystemResource) ExportTemplates(ctx context.Context, templateType string) (map[string]any, error)

ExportTemplates exports configuration templates of the given type (/api/v2/templates/export/{type}). The response is a free-form object.

func (*SystemResource) Ping added in v0.38.0

Ping is a liveness check (/api/v2/ping).

func (*SystemResource) PushToken added in v0.38.0

PushToken returns the push token (/api/v2/push-token).

func (*SystemResource) ServerTime added in v0.38.0

ServerTime returns the current server time (/api/v2/data/time).

func (*SystemResource) Tags added in v0.38.0

Tags lists all tags (/api/v2/tags).

func (*SystemResource) TagsByCategory added in v0.38.0

func (r *SystemResource) TagsByCategory(ctx context.Context, category string) (*managerapi.ObjectListResponse, error)

TagsByCategory lists tags within a category (/api/v2/tags/{category}).

func (*SystemResource) Timezones added in v0.38.0

Timezones lists the available timezones (/api/v2/data/timezones).

type TaskMetricsResource added in v0.17.0

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

TaskMetricsResource is the task & agent metrics namespace (/api/v3/tasks/metrics).

func (*TaskMetricsResource) AgentInteractionDurations added in v0.17.0

AgentInteractionDurations returns interaction durations for an agent.

func (*TaskMetricsResource) AgentJournal added in v0.17.0

AgentJournal returns the interaction journal for an agent.

func (*TaskMetricsResource) TaskJournal added in v0.17.0

TaskJournal returns the journal (event timeline) for a single task.

type TaskSchedulesResource added in v0.2.0

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

TaskSchedulesResource is the recurring task-schedule namespace (/api/v3/tasks/schedules).

func (*TaskSchedulesResource) Create added in v0.2.0

Create creates a task schedule.

func (*TaskSchedulesResource) Delete added in v0.2.0

func (r *TaskSchedulesResource) Delete(ctx context.Context, name string) error

Delete deletes a task schedule by name.

func (*TaskSchedulesResource) Get added in v0.2.0

Get returns a task schedule by name.

func (*TaskSchedulesResource) List added in v0.2.0

List returns all task schedules.

type TaskScriptsResource added in v0.17.0

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

TaskScriptsResource is the task-scripts namespace (/api/v3/tasks/scripts).

func (*TaskScriptsResource) Delete added in v0.17.0

func (r *TaskScriptsResource) Delete(ctx context.Context, scriptType taskautomationapi.ScriptType, codeID string) error

Delete deletes a script.

func (*TaskScriptsResource) Get added in v0.17.0

Get returns a script by type and code id.

func (*TaskScriptsResource) List added in v0.17.0

List lists scripts of a given type.

func (*TaskScriptsResource) Submit added in v0.17.0

Submit creates a script of a given type.

func (*TaskScriptsResource) Update added in v0.17.0

Update updates a script.

type TaskSecretsResource added in v0.17.0

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

TaskSecretsResource is the task-secrets namespace (/api/v3/tasks/configurations/secrets).

func (*TaskSecretsResource) Create added in v0.17.0

Create creates secrets under a prefix.

func (*TaskSecretsResource) DeleteKeys added in v0.17.0

func (r *TaskSecretsResource) DeleteKeys(ctx context.Context, prefix string, keys taskautomationapi.SecretKeys) error

DeleteKeys deletes the given secret keys under a prefix.

func (*TaskSecretsResource) ListKeys added in v0.17.0

ListKeys lists the secret keys under a prefix.

func (*TaskSecretsResource) ListPrefixes added in v0.17.0

ListPrefixes lists the secret prefixes.

func (*TaskSecretsResource) Patch added in v0.17.0

Patch merges secrets under a prefix.

type TaskSelectionConfigResource added in v0.17.0

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

TaskSelectionConfigResource is the account task-selection configuration (/api/v3/tasks/configurations/selection).

func (*TaskSelectionConfigResource) Create added in v0.17.0

Create creates the selection configuration.

func (*TaskSelectionConfigResource) Delete added in v0.17.0

Delete deletes the selection configuration.

func (*TaskSelectionConfigResource) Read added in v0.17.0

Read reads the current selection configuration.

func (*TaskSelectionConfigResource) Update added in v0.17.0

Update updates the selection configuration.

type TasksResource added in v0.2.0

type TasksResource struct {

	// Schedules is the recurring task-schedule namespace (/api/v3/tasks/schedules).
	Schedules *TaskSchedulesResource
	// Scripts is the task-scripts namespace (/api/v3/tasks/scripts).
	Scripts *TaskScriptsResource
	// Secrets is the task-secrets namespace (/api/v3/tasks/configurations/secrets).
	Secrets *TaskSecretsResource
	// SelectionConfig is the account task-selection configuration (/api/v3/tasks/configurations/selection).
	SelectionConfig *TaskSelectionConfigResource
	// Metrics is the task & agent metrics namespace (/api/v3/tasks/metrics).
	Metrics *TaskMetricsResource
	// contains filtered or unexported fields
}

TasksResource is the task-automation namespace (/api/v3/tasks).

func (*TasksResource) AgentAction added in v0.17.0

AgentAction performs an agent action on a task (accept / reject / complete).

func (*TasksResource) ChangeState deprecated added in v0.17.0

func (r *TasksResource) ChangeState(ctx context.Context, taskID string, taskState taskautomationapi.TaskState) error

ChangeState transitions a task to a new state.

Deprecated: deprecated by the API; prefer Interrupt.

func (*TasksResource) Create added in v0.2.0

Create creates a task.

func (*TasksResource) CreateFromTemplate added in v0.2.0

func (r *TasksResource) CreateFromTemplate(ctx context.Context, template string, overrides taskautomationapi.TemplateOverride) (*taskautomationapi.Task, error)

CreateFromTemplate creates a task from a template, with overrides.

func (*TasksResource) Get added in v0.2.0

Get returns a task by id.

func (*TasksResource) Interrupt added in v0.2.0

Interrupt manager-interrupts a task, transitioning it to the given target state.

func (*TasksResource) List added in v0.2.0

List returns an iterator over tasks, auto-paginating across pages.

func (*TasksResource) ListAll added in v0.2.0

ListAll collects every task into a slice.

func (*TasksResource) Logs added in v0.17.0

Logs returns the customer task logs.

func (*TasksResource) SetAgentLock added in v0.17.0

SetAgentLock changes the agent task-locking state.

func (*TasksResource) TestAction added in v0.17.0

TestAction tests a task action without dispatching it.

func (*TasksResource) Update added in v0.2.0

Update updates a task.

func (*TasksResource) Usage added in v0.17.0

Usage returns the task usage time series.

func (*TasksResource) UsageTypes added in v0.17.0

UsageTypes returns the available task usage types.

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
}

TokenResponse is the OAuth2 token endpoint response.

func AuthorizationCodeGrant added in v0.40.0

func AuthorizationCodeGrant(ctx context.Context, hc *http.Client, baseURL, code, redirectURI, clientID, codeVerifier, clientSecret string) (*TokenResponse, error)

AuthorizationCodeGrant exchanges an authorization code (+ PKCE verifier) for tokens via {baseURL}/oauth/token. Public clients pass an empty clientSecret. Exposed for callers who want to manage tokens themselves.

func ClientCredentialsGrant added in v0.38.0

func ClientCredentialsGrant(ctx context.Context, hc *http.Client, baseURL, clientID, clientSecret string) (*TokenResponse, error)

ClientCredentialsGrant exchanges a client_id/client_secret for a token via {baseURL}/oauth/token using the OAuth2 client_credentials grant. Exposed for callers who want to manage tokens themselves.

func PasswordGrant

func PasswordGrant(ctx context.Context, hc *http.Client, baseURL, user, pass, clientID string) (*TokenResponse, error)

PasswordGrant exchanges a username/password for a token via {baseURL}/oauth/token. Exposed for callers who want to manage tokens themselves.

func RefreshTokenGrant added in v0.40.0

func RefreshTokenGrant(ctx context.Context, hc *http.Client, baseURL, refreshToken, clientID, clientSecret string) (*TokenResponse, error)

RefreshTokenGrant exchanges the most-recently-issued refresh token for a fresh token set (rotated on every use) via {baseURL}/oauth/token. Exposed for callers who want to manage tokens themselves; the RefreshToken auth mode does this transparently.

type TriggersResource added in v0.17.0

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

TriggersResource is the workflow-triggers namespace (/api/v2/triggers).

List takes the generated parameter struct directly; the Page field is managed by the auto-paginator, so leave it unset.

func (*TriggersResource) BulkAction added in v0.38.0

func (r *TriggersResource) BulkAction(ctx context.Context, action string, ids []string) (*managerapi.BulkActionResponse, error)

BulkAction applies a bulk action (e.g. "enable", "disable", "delete") to several triggers by id.

func (*TriggersResource) Clone added in v0.17.0

Clone clones a trigger and returns the new trigger.

func (*TriggersResource) Conditions added in v0.38.0

Conditions lists a trigger's conditions.

func (*TriggersResource) Create added in v0.17.0

Create creates a trigger.

func (*TriggersResource) Delete added in v0.17.0

func (r *TriggersResource) Delete(ctx context.Context, id string) error

Delete deletes a trigger.

func (*TriggersResource) Expressions added in v0.38.0

Expressions lists the expressions available for use in trigger conditions.

func (*TriggersResource) Get added in v0.17.0

Get returns a trigger by id.

func (*TriggersResource) List added in v0.17.0

List returns an iterator over triggers, auto-paginating across pages.

func (*TriggersResource) ListAll added in v0.17.0

ListAll collects every trigger into a slice (convenience over List).

func (*TriggersResource) Operators added in v0.38.0

Operators lists the operators available for use in trigger conditions.

func (*TriggersResource) SetConditions added in v0.38.0

SetConditions replaces a trigger's conditions.

func (*TriggersResource) Test added in v0.17.0

Test tests trigger conditions against a sample payload. testMode runs without side effects.

func (*TriggersResource) Update added in v0.17.0

Update updates a trigger.

func (*TriggersResource) Uses added in v0.38.0

Uses returns where a trigger is used.

type UiSettings added in v0.4.0

UiSettings groups the `ui` settings.

type UploadLeadsOptions added in v0.38.0

type UploadLeadsOptions struct {
	// Clear clears the list before importing.
	Clear *bool
	// Mapping is a JSON string mapping CSV columns to lead fields.
	Mapping *string
	// Separator is the CSV column separator (default ",").
	Separator *string
}

UploadLeadsOptions are the optional fields accepted alongside the CSV file by UploadLeads.

type UsersResource

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

UsersResource is the user-management namespace (/api/v2/users).

func (*UsersResource) AddRoles added in v0.17.0

func (r *UsersResource) AddRoles(ctx context.Context, emails []string, roles []managerapi.AccountRole) error

AddRoles grants the given roles to the given users (by email).

func (*UsersResource) Create

Create creates a user.

func (*UsersResource) Delete

func (r *UsersResource) Delete(ctx context.Context, emails []string) error

Delete deletes the given users (by email).

func (*UsersResource) Disable

func (r *UsersResource) Disable(ctx context.Context, emails []string) error

Disable disables the given users (by email).

func (*UsersResource) Enable

func (r *UsersResource) Enable(ctx context.Context, emails []string) error

Enable enables the given users (by email).

func (*UsersResource) GetByEmail added in v0.38.0

GetByEmail returns a user by email address (GET /api/v2/users/by-email/{email}).

func (*UsersResource) List

List returns an iterator over users. The endpoint exposes no pagination parameters (no page/max query), so the SDK issues a single request and yields the response as served.

for user, err := range mgr.Users.List(ctx, manager.ListUsersQuery{}) {
    if err != nil { return err }
    fmt.Println(user.Email)
}

func (*UsersResource) ListAll

ListAll collects every user into a slice (convenience over List).

func (*UsersResource) ListRoles added in v0.17.0

func (r *UsersResource) ListRoles(ctx context.Context) ([]managerapi.AccountRole, error)

ListRoles lists the role names that can be assigned to users.

func (*UsersResource) Me added in v0.38.0

Me returns the currently authenticated user (GET /api/v2/me).

func (*UsersResource) RemoveRoles added in v0.17.0

func (r *UsersResource) RemoveRoles(ctx context.Context, emails []string, roles []managerapi.AccountRole) error

RemoveRoles revokes the given roles from the given users (by email).

func (*UsersResource) ResetPasswords added in v0.17.0

func (r *UsersResource) ResetPasswords(ctx context.Context, emails []string) error

ResetPasswords triggers a password-reset email for the given users (by email).

Directories

Path Synopsis
Command example lists users against a babelforce API host.
Command example lists users against a babelforce API host.
gen
auth
Package auth provides primitives to interact with the openapi HTTP API.
Package auth provides primitives to interact with the openapi HTTP API.
manager
Package manager provides primitives to interact with the openapi HTTP API.
Package manager provides primitives to interact with the openapi HTTP API.
taskautomation
Package taskautomation provides primitives to interact with the openapi HTTP API.
Package taskautomation provides primitives to interact with the openapi HTTP API.
taskschedule
Package taskschedule provides primitives to interact with the openapi HTTP API.
Package taskschedule provides primitives to interact with the openapi HTTP API.
user
Package user provides primitives to interact with the openapi HTTP API.
Package user provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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