assembled

package module
v0.0.0-...-5598862 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 11 Imported by: 0

README

assembled-go

GoDoc Riza

The official Assembled Go client library.

Installation

go get -u github.com/assembledhq/assembled-go

Then, import it using:

import (
    "github.com/assembledhq/assembled-go"
)

Usage

See full documentation here.

package main

import (
    "context"
    "fmt"

    "github.com/assembledhq/assembled-go"
)


func main() {
    ctx := context.Background()
    client := assembled.NewClient("<api_key>")

    resp, err := client.ListAgents(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%v\n", resp)
}

Request latency telemetry

By default, this package sends request latency telemetry back to Assembled. These numbers help Assembled improve the API for everyone.

You can disable this behavior if you prefer:

client := assembled.NewClient("<api_key>")
client.EnableTelemetry = false

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	ID string `json:"id,omitempty"`

	// An arbitrary string to be displayed to end users.
	Description string `json:"description,omitempty"`

	AgentID   string    `json:"agent_id,omitempty"` // Identifier for the corresponding agent.
	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
	TypeID    string    `json:"type_id,omitempty"` // Identifier for the associated activity type.
}

Agents can have scheduled activities that are either created directly in Assembled or sourced from other calendaring applications such as Google Calendar.

func (Activity) MarshalJSON

func (r Activity) MarshalJSON() ([]byte, error)

func (*Activity) UnmarshalJSON

func (r *Activity) UnmarshalJSON(b []byte) error

type ActivityRequest

type ActivityRequest struct {
	// One of create, update, or delete. Note that update and delete are
	// currently in beta. Contact us at support@assembled.com to be notified
	// of updates.
	Action string `json:"action,omitempty"`

	// Agents can have scheduled activities that are either created directly
	// in Assembled or sourced from other calendaring applications such as
	// Google Calendar.
	Activity Activity `json:"activity,omitempty"`
}

type ActivityType

type ActivityType struct {
	ID string `json:"id,omitempty"`

	// Channels associated with the activity. Must be non-empty when the the
	// activity is productive.
	Channels []string `json:"channels,omitempty"`

	// Third-party identifier. Supplied to Assembled and is used to uniquely
	// identify activity types across different systems.
	ImportID string `json:"import_id,omitempty"`

	// Corresponds to type in the Activity object, will be deprecated in a
	// future API version.
	Value string `json:"value,omitempty"`

	BackgroundColor string `json:"background_color,omitempty"` // Hex string.
	FontColor       string `json:"font_color,omitempty"`       // Hex string.
	Name            string `json:"name,omitempty"`
	Productive      bool   `json:"productive,omitempty"` // If true, timeoff must be false.
	ShortName       string `json:"short_name,omitempty"`
	Timeoff         bool   `json:"timeoff,omitempty"` // If true, productive must be false.
}

Activity types represent a categorization of different activities. Currently they are only editable via the dashboard.

type Agent

type Agent struct {
	ID string `json:"id,omitempty"`

	// Third-party identifier. Supplied to Assembled and is used to uniquely
	// identify agents across different systems.
	ImportID string `json:"import_id,omitempty"`

	Channels []string `json:"channels,omitempty"` // One of: 'phone', 'email', or 'chat'.
	Email    string   `json:"email,omitempty"`
	Name     string   `json:"name,omitempty"`
	Queues   []string `json:"queues,omitempty"` // Unique identifiers for associated queues.
	Site     string   `json:"site,omitempty"`   // Unique identifier for associated site.
	Skills   []string `json:"skills,omitempty"` // Unique identifiers for associated skills.
	Teams    []string `json:"teams,omitempty"`  // Unique identifiers for associated teams.
}

Agents handle units of work and can be assigned to activities or schedules. They can be grouped by site and team and can be assigned to queues or channels based on their skills.

type AgentStatus

type AgentStatus struct {
	// Identifier for the associated event with the current status.
	EventID string `json:"event_id,omitempty"`

	// Agent's current status from upstream system e.g. 'ready', 'away', or
	// 'busy'. Values are not validated.
	Status string `json:"status,omitempty"`

	AgentID   string    `json:"agent_id,omitempty"` // Identifier for the corresponding agent.
	AgentName string    `json:"agent_name,omitempty"`
	Channel   string    `json:"channel,omitempty"`
	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
}

Agents can have statuses (sourced from external systems) that indicate what they are currently working on. For example, in a phone system an agent may be “available for calls”, “busy on a call”, or “wrapping up on a call".

func (AgentStatus) MarshalJSON

func (r AgentStatus) MarshalJSON() ([]byte, error)

func (*AgentStatus) UnmarshalJSON

func (r *AgentStatus) UnmarshalJSON(b []byte) error

type Client

type Client struct {
	Base            string
	HTTP            http.Client
	EnableTelemetry bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(key string) *Client

func (*Client) CreateActivity

func (c *Client) CreateActivity(ctx context.Context, r *CreateActivityRequest) (*Activity, error)

Creates an activity with the specified parameters. Valid IDs for agents can be retrieved from the agent endpoints. Valid IDs for activity types can be retrieved from the activity types endpoints. This endpoint will return 400 if invalid IDs are provided.

func (*Client) CreateActivityType

func (c *Client) CreateActivityType(ctx context.Context, r *CreateActivityTypeRequest) (*ActivityType, error)

Creates an activity type.

func (*Client) CreateAgent

func (c *Client) CreateAgent(ctx context.Context, r *CreateAgentRequest) (*Agent, error)

Creates an agent profile with the specified parameters. Valid IDs for site, teams, and queues can be retrieved from endpoints for filters. This endpoint will return 400 if invalid IDs are provided.

func (*Client) CreateAgentStatus

func (c *Client) CreateAgentStatus(ctx context.Context, r *CreateAgentStatusRequest) (*AgentStatus, error)

func (*Client) CreateBulkActivity

Creates, updates, or deletes multiple activities in a single request. A given request occurs within a transaction, so in the event of an error during the request, it should be assumed that no changes were processed.

func (*Client) CreateQueue

func (c *Client) CreateQueue(ctx context.Context, r *CreateQueueRequest) (*QueuesList, error)

func (*Client) CreateRequirement

func (c *Client) CreateRequirement(ctx context.Context, r *CreateRequirementRequest) (*Requirement, error)

Creates or overwrites a requirement with the specified parameters.

func (*Client) CreateSite

func (c *Client) CreateSite(ctx context.Context, r *CreateSiteRequest) (*SitesList, error)

func (*Client) CreateSkill

func (c *Client) CreateSkill(ctx context.Context, r *CreateSkillRequest) (*SkillsList, error)

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, r *CreateTeamRequest) (*TeamsList, error)

func (*Client) DeleteActivities

func (c *Client) DeleteActivities(ctx context.Context, r *DeleteActivitiesRequest) error

Deletes all activities that match the specified parameters. Valid IDs for agents can be retrieved from the agent endpoints. This endpoint will return 400 if invalid IDs are provided.

Activities can be partially deleted. For example, if agent XYZ has an activity from 3pm-5pm and the deletion window is from 4pm-5pm, there will still exist a 3-4pm activity for agent XYZ after the deletion is completed.

func (*Client) DeleteActivityType

func (c *Client) DeleteActivityType(ctx context.Context, r *DeleteActivityTypeRequest) (*ActivityType, error)

Deletes an activity type.

func (*Client) DeleteQueues

func (c *Client) DeleteQueues(ctx context.Context, r *DeleteQueuesRequest) error

func (*Client) DeleteSites

func (c *Client) DeleteSites(ctx context.Context, r *DeleteSitesRequest) error

func (*Client) DeleteSkills

func (c *Client) DeleteSkills(ctx context.Context, r *DeleteSkillsRequest) error

func (*Client) DeleteTeams

func (c *Client) DeleteTeams(ctx context.Context, r *DeleteTeamsRequest) error

func (*Client) GetAgentStatus

func (c *Client) GetAgentStatus(ctx context.Context, r *GetAgentStatusRequest) (*AgentStatus, error)

func (*Client) ListActivities

Returns a list of activity objects that match the provided query.

func (*Client) ListActivityTypes

func (c *Client) ListActivityTypes(ctx context.Context) (*ListActivityTypesResponse, error)

Returns a list of all activity type objects configured on the account.

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context, r *ListAgentsRequest) (*ListAgentsResponse, error)

Returns a list of agent objects that match the provided query.

func (*Client) ListQueues

func (c *Client) ListQueues(ctx context.Context) (*QueuesList, error)

func (*Client) ListRequirementTypes

func (c *Client) ListRequirementTypes(ctx context.Context) (*ListRequirementTypesResponse, error)

Returns a list of all requirement type objects configured on the account.

func (*Client) ListRequirements

Returns a list of requirement objects that match the provided query.

func (*Client) ListSites

func (c *Client) ListSites(ctx context.Context) (*SitesList, error)

func (*Client) ListSkills

func (c *Client) ListSkills(ctx context.Context) (*SkillsList, error)

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context) (*TeamsList, error)

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, r *UpdateAgentRequest) (*Agent, error)

Partial update of an agent with the specified fields. Fields that are not included in the request are not updated, while fields that are explicitly set to null or an appropriate empty value (for example, "[]" for lists) are set to empty. Valid IDs for site, teams, and queues can be retrieved from endpoints for filters. This endpoint will return 400 if invalid filter IDs are provided.

func (*Client) UpdateQueues

func (c *Client) UpdateQueues(ctx context.Context, r *UpdateQueuesRequest) (*Filter, error)

func (*Client) UpdateSites

func (c *Client) UpdateSites(ctx context.Context, r *UpdateSitesRequest) (*Filter, error)

func (*Client) UpdateSkills

func (c *Client) UpdateSkills(ctx context.Context, r *UpdateSkillsRequest) (*Filter, error)

func (*Client) UpdateTeams

func (c *Client) UpdateTeams(ctx context.Context, r *UpdateTeamsRequest) (*Filter, error)

type CreateActivityRequest

type CreateActivityRequest struct {
	// Whether or not to allow conflicting events. If true, this created
	// activity will be allowed to have conflicts with other activities. If
	// false, any overlapping activities for the specified agent will be
	// deleted. Defaults to false.
	AllowConflicts bool `json:"allow_conflicts,omitempty"`

	// An arbitrary string to be displayed to end users.
	Description string `json:"description,omitempty"`

	// Identifier for the corresponding schedule. Defaults to the master
	// schedule.
	ScheduleID string `json:"schedule_id,omitempty"`

	AgentID   string    `json:"agent_id,omitempty"` // Unique identifier for an agent.
	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
	TypeID    string    `json:"type_id,omitempty"` // Unique identifier for an activity type.
}

func (CreateActivityRequest) MarshalJSON

func (r CreateActivityRequest) MarshalJSON() ([]byte, error)

func (*CreateActivityRequest) UnmarshalJSON

func (r *CreateActivityRequest) UnmarshalJSON(b []byte) error

type CreateActivityTypeRequest

type CreateActivityTypeRequest struct {
	// Channels associated with the activity. Must be non-empty when the the
	// activity is productive.
	Channels []string `json:"channels,omitempty"`

	// Third-party identifier. Supplied to Assembled and is used to uniquely
	// identify activity types across different systems.
	ImportID string `json:"import_id,omitempty"`

	// Corresponds to type in the Activity object, will be deprecated in a
	// future API version.
	Value string `json:"value,omitempty"`

	BackgroundColor string `json:"background_color,omitempty"` // Hex string.
	FontColor       string `json:"font_color,omitempty"`       // Hex string.
	Name            string `json:"name,omitempty"`
	Productive      bool   `json:"productive,omitempty"` // If true, timeoff must be false.
	ShortName       string `json:"short_name,omitempty"`
	Timeoff         bool   `json:"timeoff,omitempty"` // If true, productive must be false.
}

type CreateAgentRequest

type CreateAgentRequest struct {
	// Third-party identifier. Supplied to Assembled and is used to uniquely
	// identify agents across different systems.
	ImportID string `json:"import_id,omitempty"`

	Channels []string `json:"channels,omitempty"` // One of: 'phone', 'email', or 'chat'.
	Email    string   `json:"email,omitempty"`
	Name     string   `json:"name,omitempty"`
	Queues   []string `json:"queues,omitempty"` // Unique identifiers for associated queues.
	Site     string   `json:"site,omitempty"`   // Unique identifier for associated site.
	Skills   []string `json:"skills,omitempty"` // Unique identifiers for associated skills.
	Teams    []string `json:"teams,omitempty"`  // Unique identifiers for associated teams.
}

type CreateAgentStatusRequest

type CreateAgentStatusRequest struct {
	// Identifier for the associated event with the current status.
	EventID string `json:"event_id,omitempty"`

	// Agent's current status from upstream system e.g. 'ready', 'away', or
	// 'busy'. Values are not validated.
	Status string `json:"status,omitempty"`

	AgentID   string    `json:"agent_id,omitempty"` // Identifier for the corresponding agent.
	AgentName string    `json:"agent_name,omitempty"`
	Channel   string    `json:"channel,omitempty"`
	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
}

func (CreateAgentStatusRequest) MarshalJSON

func (r CreateAgentStatusRequest) MarshalJSON() ([]byte, error)

func (*CreateAgentStatusRequest) UnmarshalJSON

func (r *CreateAgentStatusRequest) UnmarshalJSON(b []byte) error

type CreateBulkActivityRequest

type CreateBulkActivityRequest struct {
	// An array of requests following the format below.
	Activities []ActivityRequest `json:"activities,omitempty"`

	// Identifier for the corresponding schedule. Defaults to the master
	// schedule.
	ScheduleID string `json:"schedule_id,omitempty"`
}

type CreateBulkActivityResponse

type CreateBulkActivityResponse struct {
	Activities map[string]Activity `json:"activities,omitempty"`
}

type CreateQueueRequest

type CreateQueueRequest struct {
	Queues []Filter `json:"queues,omitempty"`
}

type CreateRequirementRequest

type CreateRequirementRequest struct {
	EndTime           time.Time `json:"end_time,omitempty"`
	Required          int       `json:"required,omitempty"`
	RequirementTypeID string    `json:"requirement_type_id,omitempty"`
	StartTime         time.Time `json:"start_time,omitempty"`
}

func (CreateRequirementRequest) MarshalJSON

func (r CreateRequirementRequest) MarshalJSON() ([]byte, error)

func (*CreateRequirementRequest) UnmarshalJSON

func (r *CreateRequirementRequest) UnmarshalJSON(b []byte) error

type CreateSiteRequest

type CreateSiteRequest struct {
	Sites []Filter `json:"sites,omitempty"`
}

type CreateSkillRequest

type CreateSkillRequest struct {
	Skills []Filter `json:"skills,omitempty"`
}

type CreateTeamRequest

type CreateTeamRequest struct {
	Teams []Filter `json:"teams,omitempty"`
}

type DeleteActivitiesRequest

type DeleteActivitiesRequest struct {
	// Unique identifiers for agents. All activities in the deletion window
	// will be deleted for each specified agent.
	AgentIDs []string `json:"agent_ids,omitempty"`

	// Identifier for the corresponding schedule. Defaults to the master
	// schedule.
	ScheduleID string `json:"schedule_id,omitempty"`

	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
}

func (DeleteActivitiesRequest) MarshalJSON

func (r DeleteActivitiesRequest) MarshalJSON() ([]byte, error)

func (*DeleteActivitiesRequest) UnmarshalJSON

func (r *DeleteActivitiesRequest) UnmarshalJSON(b []byte) error

type DeleteActivityTypeRequest

type DeleteActivityTypeRequest struct {
	ID string `json:"id,omitempty"`
}

type DeleteQueuesRequest

type DeleteQueuesRequest struct {
	QueueIDs []string `json:"queue_ids,omitempty"`
}

type DeleteSitesRequest

type DeleteSitesRequest struct {
	SiteIDs []string `json:"site_ids,omitempty"`
}

type DeleteSkillsRequest

type DeleteSkillsRequest struct {
	SkillIDs []string `json:"skill_ids,omitempty"`
}

type DeleteTeamsRequest

type DeleteTeamsRequest struct {
	TeamIDs []string `json:"team_ids,omitempty"`
}

type Error

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

func (Error) Error

func (e Error) Error() string

type Filter

type Filter struct {
	ID string `json:"id,omitempty"`

	// Identifier for the parent filter. May be null.
	ParentID string `json:"parent_id,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
	Name      string    `json:"name,omitempty"` // Identifier for the filter.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

Filters can be used to categorize or group agents as well as activities.

func (Filter) MarshalJSON

func (r Filter) MarshalJSON() ([]byte, error)

func (*Filter) UnmarshalJSON

func (r *Filter) UnmarshalJSON(b []byte) error

type GetAgentStatusRequest

type GetAgentStatusRequest struct {
	ID string `json:"id,omitempty"`
}

type ListActivitiesRequest

type ListActivitiesRequest struct {
	// If true, include activity types active on the account. Defaults to
	// false.
	IncludeActivityTypes bool `json:"include_activity_types,omitempty"`

	// If true, include associated agent objects. Defaults to false.
	IncludeAgents bool `json:"include_agents,omitempty"`

	// Identifier for the corresponding schedule. Defaults to the master
	// schedule.
	ScheduleID string `json:"schedule_id,omitempty"`

	Agents    []string  `json:"agents,omitempty"`  // Filter results to a specific set of agents.
	Channel   string    `json:"channel,omitempty"` // Filter results to a specific channel.
	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
	Team      string    `json:"team,omitempty"`  // Filter results to a specific team.
	Types     []string  `json:"types,omitempty"` // Filter results to a specific set of types.
}

func (ListActivitiesRequest) MarshalJSON

func (r ListActivitiesRequest) MarshalJSON() ([]byte, error)

func (*ListActivitiesRequest) UnmarshalJSON

func (r *ListActivitiesRequest) UnmarshalJSON(b []byte) error

type ListActivitiesResponse

type ListActivitiesResponse struct {
	Activities map[string]Activity `json:"activities,omitempty"`
	Agents     map[string]Agent    `json:"agents,omitempty"`
	Queues     map[string]Queue    `json:"queues,omitempty"`
}

type ListActivityTypesResponse

type ListActivityTypesResponse struct {
	ActivityTypes map[string]ActivityType `json:"activity_types,omitempty"`
}

type ListAgentsRequest

type ListAgentsRequest struct {
	Channels []string `json:"channels,omitempty"` // One of: 'phone', 'email', or 'chat'.
	Queue    string   `json:"queue,omitempty"`    // Name of the queue to filter on.
	Site     string   `json:"site,omitempty"`     // Name of the site to filter on.
	Team     string   `json:"team,omitempty"`     // Name of the team to filter on.
}

type ListAgentsResponse

type ListAgentsResponse struct {
	Agents map[string]Agent `json:"agents,omitempty"`
}

type ListRequirementTypesResponse

type ListRequirementTypesResponse struct {
	RequirementTypes map[string]RequirementType `json:"requirement_types,omitempty"`
}

type ListRequirementsRequest

type ListRequirementsRequest struct {
	// Filter results to a specific set of requirement types.
	RequirementTypes []string `json:"requirement_types,omitempty"`

	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
}

func (ListRequirementsRequest) MarshalJSON

func (r ListRequirementsRequest) MarshalJSON() ([]byte, error)

func (*ListRequirementsRequest) UnmarshalJSON

func (r *ListRequirementsRequest) UnmarshalJSON(b []byte) error

type ListRequirementsResponse

type ListRequirementsResponse struct {
	Requirements []Requirement `json:"requirements,omitempty"`
}

type Queue

type Queue struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type QueuesList

type QueuesList struct {
	Queues map[string]Filter `json:"queues,omitempty"`
}

type Requirement

type Requirement struct {
	// Count of required staffing in the interval, can be partial.
	Required int `json:"required,omitempty"`

	// Unique identifier for the corresponding requirement type.
	RequirementTypeID string `json:"requirement_type_id,omitempty"`

	// Count of scheduled staffing in the interval, can be partial.
	Scheduled int `json:"scheduled,omitempty"`

	EndTime   time.Time `json:"end_time,omitempty"`
	StartTime time.Time `json:"start_time,omitempty"`
}

Requirements represent a set of staffing requirements and grouped staffing against the requirement within a given time window. They correspond to metrics about required staffing and scheduled staffing that appear above the team calendar.

func (Requirement) MarshalJSON

func (r Requirement) MarshalJSON() ([]byte, error)

func (*Requirement) UnmarshalJSON

func (r *Requirement) UnmarshalJSON(b []byte) error

type RequirementType

type RequirementType struct {
	ID string `json:"id,omitempty"`

	// List of unique identifiers for activity types that count as scheduled
	// against the requirement.
	ActivityTypeIDs []string `json:"activity_type_ids,omitempty"`

	Name string `json:"name,omitempty"`
}

Requirement types contain metadata about named set of staffing requirements.

type SitesList

type SitesList struct {
	Sites map[string]Filter `json:"sites,omitempty"`
}

type SkillsList

type SkillsList struct {
	Skills map[string]Filter `json:"skills,omitempty"`
}

type TeamsList

type TeamsList struct {
	Teams map[string]Filter `json:"teams,omitempty"`
}

type UpdateAgentRequest

type UpdateAgentRequest struct {
	ID string `json:"id,omitempty"`

	// Third-party identifier. Supplied to Assembled and is used to uniquely
	// identify agents across different systems.
	ImportID string `json:"import_id,omitempty"`

	Channels []string `json:"channels,omitempty"` // One of: 'phone', 'email', or 'chat'.
	Email    string   `json:"email,omitempty"`
	Name     string   `json:"name,omitempty"`
	Queues   []string `json:"queues,omitempty"` // Unique identifiers for associated queues.
	Site     string   `json:"site,omitempty"`   // Unique identifier for associated site.
	Skills   []string `json:"skills,omitempty"` // Unique identifiers for associated skills.
	Teams    []string `json:"teams,omitempty"`  // Unique identifiers for associated teams.
}

type UpdateQueuesRequest

type UpdateQueuesRequest struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

type UpdateSitesRequest

type UpdateSitesRequest struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

type UpdateSkillsRequest

type UpdateSkillsRequest struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

type UpdateTeamsRequest

type UpdateTeamsRequest struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

Jump to

Keyboard shortcuts

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