pub struct AgentsResource {
pub groups: AgentGroupsResource,
/* private fields */
}Expand description
Agent management — /api/v2/agents, with a nested groups sub-resource.
Fields§
§groups: AgentGroupsResourceAgent groups — /api/v2/agents/groups.
Implementations§
Source§impl AgentsResource
impl AgentsResource
Sourcepub async fn list(
&self,
query: ListAgentsQuery,
) -> Result<Vec<Agent>, ManagerError>
pub async fn list( &self, query: ListAgentsQuery, ) -> Result<Vec<Agent>, ManagerError>
List agents matching query, auto-paginated across pages.
Stands in for the generated list_agents, whose groupIds/groups/tags parameters
(anyOf string-or-array types) are JSON-serialized into the query — a single id would be
sent as ?groupIds="…" with literal quotes, which the server does not match. The facade
builds the form/explode query itself and decodes into the same generated response model.
Sourcepub async fn list_all(&self) -> Result<Vec<Agent>, ManagerError>
pub async fn list_all(&self) -> Result<Vec<Agent>, ManagerError>
List all agents (unfiltered, auto-paginated) — AgentsResource::list with no filters.
Sourcepub async fn list_page(
&self,
page: i32,
per_page: Option<i32>,
query: ListAgentsQuery,
) -> Result<Page<Agent>, ManagerError>
pub async fn list_page( &self, page: i32, per_page: Option<i32>, query: ListAgentsQuery, ) -> Result<Page<Agent>, ManagerError>
List one page of agents, optionally filtered server-side.
Sourcepub async fn create(
&self,
body: RestCreateAgent,
) -> Result<AgentItemResponse, ManagerError>
pub async fn create( &self, body: RestCreateAgent, ) -> Result<AgentItemResponse, ManagerError>
Create an agent.
Sourcepub async fn get(&self, id: &str) -> Result<AgentItemResponse, ManagerError>
pub async fn get(&self, id: &str) -> Result<AgentItemResponse, ManagerError>
Get an agent by id.
Sourcepub async fn update(
&self,
id: &str,
body: RestUpdateAgent,
) -> Result<AgentItemResponse, ManagerError>
pub async fn update( &self, id: &str, body: RestUpdateAgent, ) -> Result<AgentItemResponse, ManagerError>
Update an agent.
Sourcepub async fn update_status(
&self,
id: &str,
status: UpdateAgentStatusRequest,
) -> Result<AgentStatus, ManagerError>
pub async fn update_status( &self, id: &str, status: UpdateAgentStatusRequest, ) -> Result<AgentStatus, ManagerError>
Update an agent’s status.
Sourcepub async fn presences(&self) -> Result<AgentPresenceListResponse, ManagerError>
pub async fn presences(&self) -> Result<AgentPresenceListResponse, ManagerError>
List agent presences.
Sourcepub async fn get_presence(
&self,
name: &str,
) -> Result<AgentPresenceItemResponse, ManagerError>
pub async fn get_presence( &self, name: &str, ) -> Result<AgentPresenceItemResponse, ManagerError>
Get an agent presence by name.
Sourcepub async fn create_presence(
&self,
body: AgentPresenceWriteBody,
) -> Result<AgentPresenceItemResponse, ManagerError>
pub async fn create_presence( &self, body: AgentPresenceWriteBody, ) -> Result<AgentPresenceItemResponse, ManagerError>
Create an agent presence.
Sourcepub async fn update_presence(
&self,
name: &str,
body: AgentPresenceWriteBody,
) -> Result<AgentPresenceItemResponse, ManagerError>
pub async fn update_presence( &self, name: &str, body: AgentPresenceWriteBody, ) -> Result<AgentPresenceItemResponse, ManagerError>
Update an agent presence.
Sourcepub async fn delete_presence(
&self,
name: &str,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn delete_presence( &self, name: &str, ) -> Result<DefaultV2MessageResponse, ManagerError>
Delete an agent presence.
Sourcepub async fn get_status(
&self,
id: &str,
) -> Result<AgentTotalStatusResponse, ManagerError>
pub async fn get_status( &self, id: &str, ) -> Result<AgentTotalStatusResponse, ManagerError>
Get an agent’s total status by id.
Sourcepub async fn available_statuses(
&self,
) -> Result<AgentAvailabilityListResponse, ManagerError>
pub async fn available_statuses( &self, ) -> Result<AgentAvailabilityListResponse, ManagerError>
List available agent statuses.
Sourcepub async fn enable(
&self,
id: &str,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn enable( &self, id: &str, ) -> Result<DefaultV2MessageResponse, ManagerError>
Enable an agent.
Sourcepub async fn disable(
&self,
id: &str,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn disable( &self, id: &str, ) -> Result<DefaultV2MessageResponse, ManagerError>
Disable an agent.
Sourcepub async fn hangup_call(
&self,
id: &str,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn hangup_call( &self, id: &str, ) -> Result<DefaultV2MessageResponse, ManagerError>
Hang up an agent’s active call.
Sourcepub async fn bulk_action(
&self,
action: &str,
body: AgentBulkRequest,
) -> Result<AgentBulkResponse, ManagerError>
pub async fn bulk_action( &self, action: &str, body: AgentBulkRequest, ) -> Result<AgentBulkResponse, ManagerError>
Perform a bulk action (e.g. enable, disable, delete) on multiple agents.
Sourcepub async fn export(&self, format: &str) -> Result<String, ManagerError>
pub async fn export(&self, format: &str) -> Result<String, ManagerError>
Export all agents in the given format.
Sourcepub async fn import_agents(
&self,
format: &str,
file: PathBuf,
async: Option<bool>,
create_only: Option<bool>,
update_only: Option<bool>,
delete_unlisted: Option<bool>,
) -> Result<AgentImportValidationResults, ManagerError>
pub async fn import_agents( &self, format: &str, file: PathBuf, async: Option<bool>, create_only: Option<bool>, update_only: Option<bool>, delete_unlisted: Option<bool>, ) -> Result<AgentImportValidationResults, ManagerError>
Import agents from a file in the given format.
Sourcepub async fn validate_import(
&self,
file: PathBuf,
) -> Result<AgentImportValidationResults, ManagerError>
pub async fn validate_import( &self, file: PathBuf, ) -> Result<AgentImportValidationResults, ManagerError>
Validate an agent import file without applying it.
Sourcepub async fn get_import_job(
&self,
id: &str,
) -> Result<AgentImportJobItemResponse, ManagerError>
pub async fn get_import_job( &self, id: &str, ) -> Result<AgentImportJobItemResponse, ManagerError>
Get an agent import job by id.
Sourcepub async fn logs(
&self,
id: &str,
from: Option<i32>,
to: Option<i32>,
) -> Result<Vec<AgentLogEntry>, ManagerError>
pub async fn logs( &self, id: &str, from: Option<i32>, to: Option<i32>, ) -> Result<Vec<AgentLogEntry>, ManagerError>
List an agent’s logs (auto-paginated), optionally filtered by a from/to range.
Sourcepub async fn all_logs(&self) -> Result<Vec<AgentLogEntry>, ManagerError>
pub async fn all_logs(&self) -> Result<Vec<AgentLogEntry>, ManagerError>
List logs across all agents (auto-paginated).
Sourcepub async fn push(
&self,
body: AgentPushRequest,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn push( &self, body: AgentPushRequest, ) -> Result<DefaultV2MessageResponse, ManagerError>
Push a message to an agent (or broadcast to all agents).
Sourcepub async fn update_password(
&self,
id: &str,
body: AgentPasswordUpdateRequest,
) -> Result<DefaultV2MessageResponse, ManagerError>
pub async fn update_password( &self, id: &str, body: AgentPasswordUpdateRequest, ) -> Result<DefaultV2MessageResponse, ManagerError>
Update an agent’s password.