Пример #1
0
 /// <summary>
 /// Get the details for a specific Media instance.
 /// </summary>
 public virtual void GetMessageMedia(string messageSid, string mediaSid, Action<Media> callback)
 {
     var request = new RestRequest();
     request.Resource = "Accounts/{AccountSid}/Messages/{MessageSid}/Media/{MediaSid}.json";
     request.AddUrlSegment("MediaSid", mediaSid);
     request.AddUrlSegment("MessageSid", messageSid);
     ExecuteAsync<Media>(request, (response) => callback(response));
 }
Пример #2
0
 /// <summary>
 /// Get the details for a specific Media instance.
 /// </summary>
 /// <param name="mediaSid">The Sid of the media resource</param>
 /// <returns></returns>
 public virtual async Task<Media> GetMessageMediaAsync(string messageSid, string mediaSid)
 {
     var request = new RestRequest();
     request.Resource = "Accounts/{AccountSid}/Messages/{MessageSid}/Media/{MediaSid}.json";
     request.AddUrlSegment("MediaSid", mediaSid);
     request.AddUrlSegment("MessageSid", messageSid);
     return await Execute<Media>(request);
 }
Пример #3
0
        /// <summary>
        /// Retrieve the details for a workflow instance. Makes a GET request to a Workflow Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the workflow belongs to</param>
        /// <param name="workflowSid">The Sid of the workflow to retrieve</param>
        public virtual Workflow GetWorkflow(string workspaceSid, string workflowSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("WorkflowSid", workflowSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkflowSid", workflowSid);

            return Execute<Workflow>(request);
        }
Пример #4
0
        /// <summary>
        /// Retrieve the details for a task queue instance. Makes a GET request to a TaskQueue Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="taskQueueSid">The Sid of the task queue to retrieve</param>
        public virtual TaskQueue GetTaskQueue(string workspaceSid, string taskQueueSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("TaskQueueSid", taskQueueSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskQueueSid", taskQueueSid);

            return Execute<TaskQueue>(request);
        }
Пример #5
0
        /// <summary>
        /// Retrieve the details for a task queue instance. Makes a GET request to a TaskQueue Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="taskQueueSid">The Sid of the task queue to retrieve</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void GetTaskQueue(string workspaceSid, string taskQueueSid, Action<TaskQueue> callback)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("TaskQueueSid", taskQueueSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskQueueSid", taskQueueSid);

            ExecuteAsync<TaskQueue>(request, (response) => { callback(response); });
        }
Пример #6
0
        /// <summary>
        /// Retrieve the details for a workflow instance. Makes a GET request to a Workflow Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the workflow belongs to</param>
        /// <param name="workflowSid">The Sid of the workflow to retrieve</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void GetWorkflow(string workspaceSid, string workflowSid, Action<Workflow> callback)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("WorkflowSid", workflowSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkflowSid", workflowSid);

            ExecuteAsync<Workflow>(request, (response) => { callback(response); });
        }
Пример #7
0
        /// <summary>
        /// Retrieve the details for an activity instance. Makes a GET request to an Activity Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="activitySid">The Sid of the activity to retrieve</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void GetActivity(string workspaceSid, string activitySid, Action<Activity> callback)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("ActivitySid", activitySid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Activities/{ActivitySid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("ActivitySid", activitySid);

            ExecuteAsync<Activity>(request, (response) => { callback(response); });
        }
Пример #8
0
        /// <summary>
        /// Retrieve the details for a task instance. Makes a GET request to a Task Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="taskSid">The Sid of the task to retrieve</param>
        public virtual async Task<Task> GetTaskAsync(string workspaceSid, string taskSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("TaskSid", taskSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Tasks/{TaskSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskSid", taskSid);

            return await Execute<Task>(request);
        }
Пример #9
0
        /// <summary>
        /// Gets the event.
        /// </summary>
        /// <param name="workspaceSid">Workspace sid.</param>
        /// <param name="eventSid">Event sid.</param>
        public virtual async Task<Event> GetEventAsync(string workspaceSid, string eventSid)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("EventSid", eventSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Events/{EventSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("EventSid", eventSid);

            return await Execute<Event>(request);
        }
Пример #10
0
        /// <summary>
        /// Retrieve the details for an activity instance. Makes a GET request to an Activity Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="activitySid">The Sid of the activity to retrieve</param>
        public virtual Activity GetActivity(string workspaceSid, string activitySid)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("ActivitySid", activitySid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Activities/{ActivitySid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("ActivitySid", activitySid);

            return Execute<Activity>(request);
        }
Пример #11
0
        /// <summary>
        /// Retrieve the details for a worker instance. Makes a GET request to a Worker Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the worker belongs to</param>
        /// <param name="workerSid">The Sid of the worker to retrieve</param>
        public virtual async Task<Worker> GetWorkerAsync(string workspaceSid, string workerSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("WorkerSid", workerSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Workers/{WorkerSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkerSid", workerSid);

            return await Execute<Worker>(request);
        }
Пример #12
0
        /// <summary>
        /// Delete a workflow.
        /// </summary>
        /// <returns>The workflow.</returns>
        /// <param name="workspaceSid">Workspace sid.</param>
        /// <param name="workflowSid">Workflow sid.</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void DeleteWorkflow(string workspaceSid, string workflowSid, Action<DeleteStatus> callback)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("WorkflowSid", workflowSid);

            var request = new RestRequest(Method.DELETE);
            request.Resource = "Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkflowSid", workflowSid);

            ExecuteAsync(request, (response) => { callback(response.StatusCode == System.Net.HttpStatusCode.NoContent ? DeleteStatus.Success : DeleteStatus.Failed); });
        }
Пример #13
0
        /// <summary>
        /// Delete a worker.
        /// </summary>
        /// <param name="workspaceSid">Workspace sid.</param>
        /// <param name="workerSid">Worker sid.</param>
        public virtual async Task<DeleteStatus> DeleteWorkerAsync(string workspaceSid, string workerSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("WorkerSid", workerSid);

            var request = new RestRequest(Method.DELETE);
            request.Resource = "Workspaces/{WorkspaceSid}/Workers/{WorkerSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkerSid", workerSid);

            var response = await Execute(request);
            return response.StatusCode == System.Net.HttpStatusCode.NoContent ? DeleteStatus.Success : DeleteStatus.Failed;
        }
Пример #14
0
        /// <summary>
        /// Delete a task.
        /// </summary>
        /// <param name="workspaceSid">Workspace sid.</param>
        /// <param name="taskSid">Task sid.</param>
        public virtual DeleteStatus DeleteTask(string workspaceSid, string taskSid)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("TaskSid", taskSid);

            var request = new RestRequest(Method.DELETE);
            request.Resource = "Workspaces/{WorkspaceSid}/Tasks/{TaskSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskSid", taskSid);

            var response = Execute(request);
            return response.StatusCode == System.Net.HttpStatusCode.NoContent ? DeleteStatus.Success : DeleteStatus.Failed;
        }
Пример #15
0
        /// <summary>
        /// Delete an activity.
        /// </summary>
        /// <param name="workspaceSid">Workspace sid.</param>
        /// <param name="activitySid">Activity sid.</param>
        public virtual DeleteStatus DeleteActivity(string workspaceSid, string activitySid)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("ActivitySid", activitySid);

            var request = new RestRequest(Method.DELETE);
            request.Resource = "Workspaces/{WorkspaceSid}/Activities/{ActivitySid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("ActivitySid", activitySid);

            var response = Execute(request);
            return response.StatusCode == System.Net.HttpStatusCode.NoContent ? DeleteStatus.Success : DeleteStatus.Failed;
        }
Пример #16
0
        /// <summary>
        /// Retrieve the details for a reservation instance. Makes a GET request to an Reservation Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the reservation belongs to</param>
        /// <param name="taskSid">The Sid of the task the reservation belongs to</param>
        /// <param name="reservationSid">The Sid of the reservation to retrieve</param>
        public virtual Reservation GetReservation(string workspaceSid, string taskSid, string reservationSid)
        {
            //Require.Argument("WorkspaceSid", workspaceSid);
            //Require.Argument("TaskSid", taskSid);
            //Require.Argument("ReservationSid", reservationSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{ReservationSid}";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskSid", taskSid);
            request.AddUrlSegment("ReservationSid", reservationSid);

            return Execute<Reservation>(request);
        }
        /// <summary>
        /// Retrieve the details for a task queue statistics instance. Makes a GET request to a TaskQueueStatistics Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="taskQueueSid">The Sid of the task queue to retrieve</param>
        /// <param name="options">Time interval options</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void GetTaskQueueStatistics(string workspaceSid, string taskQueueSid, StatisticsRequest options, Action<TaskQueueStatistics> callback)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("TaskQueueSid", taskQueueSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/Statistics";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("TaskQueueSid", taskQueueSid);

            AddStatisticsDateOptions(options, request);

            ExecuteAsync<TaskQueueStatistics>(request, (response) => { callback(response); });
        }
        /// <summary>
        /// Retrieve the details for a worker statistics instance. Makes a GET request to a WorkerStatistics Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="workerSid">The Sid of the worker to retrieve</param>
        /// <param name="options">Filtering options for statistics</param>
        public virtual async Task<WorkerStatistics> GetWorkerStatisticsAsync(string workspaceSid, string workerSid, StatisticsRequest options)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("WorkerSid", workerSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Statistics";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkerSid", workerSid);

            AddStatisticsDateOptions(options, request);

            return await Execute<WorkerStatistics>(request);
        }
Пример #19
0
        /// <summary>
        /// Retrieve the details for a workflow statistics instance. Makes a GET request to a WorkflowStatistics Instance resource.
        /// </summary>
        /// <param name="workspaceSid">The Sid of the workspace the activity belongs to</param>
        /// <param name="workflowSid">The Sid of the workflow to retrieve</param>
        /// <param name="options">Time-interval options.</param>
        public virtual WorkflowStatistics GetWorkflowStatistics(string workspaceSid, string workflowSid, StatisticsRequest options)
        {
            Require.Argument("WorkspaceSid", workspaceSid);
            Require.Argument("WorkflowSid", workflowSid);

            var request = new RestRequest();
            request.Resource = "Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/Statistics";

            request.AddUrlSegment("WorkspaceSid", workspaceSid);
            request.AddUrlSegment("WorkflowSid", workflowSid);

            AddStatisticsDateOptions(options, request);

            return Execute<WorkflowStatistics>(request);
        }
Пример #20
0
        /// <summary>
        /// Locates and returns a specific SIP Domain resource
        /// </summary>
        /// <param name="domainSid">The Sid of the SIP Domain to locate</param>
        /// <returns></returns>
        public virtual Domain GetDomain(string domainSid)
        {
            var request = new RestRequest();
            request.Resource = "Accounts/{AccountSid}/SIP/Domains/{DomainSid}.json";
            request.AddUrlSegment("DomainSid", domainSid);

            return Execute<Domain>(request);
        }
Пример #21
0
        public virtual async Task<VoiceNumber> GetVoiceNumberAsync(string number)
        {
            var request = new RestRequest(Method.GET);
            request.Resource = "Voice/Numbers/{Number}";
            request.AddUrlSegment("Number", number);

            return await Execute<VoiceNumber>(request);
        }
Пример #22
0
        public virtual VoiceNumber GetVoiceNumber(string number)
        {
            var request = new RestRequest("GET");
            request.Resource = "Voice/Numbers/{Number}";
            request.AddUrlSegment("Number", number);

            return Execute<VoiceNumber>(request);
        }
Пример #23
0
        /// <summary>
        /// Retrieve the details for a specific SMS message instance
        /// </summary>
        /// <param name="smsMessageSid">The Sid of the message to retrieve</param>
        /// <param name="callback">Method to call upon successful completion</param>
        public virtual void GetSmsMessage(string smsMessageSid, Action<SMSMessage> callback)
        {
            var request = new RestRequest();
            request.Resource = "Accounts/{AccountSid}/SMS/Messages/{SMSMessageSid}.json";
                        request.AddUrlSegment("SMSMessageSid", smsMessageSid);

            ExecuteAsync<SMSMessage>(request, (response) => callback(response));
        }
Пример #24
0
        public virtual VoiceCountry GetVoiceCountry(string isoCountry)
        {
            var request = new RestRequest("GET");
            request.Resource = "Voice/Countries/{IsoCountry}";
            request.AddUrlSegment("IsoCountry", isoCountry);

            return Execute<VoiceCountry>(request);
        }
Пример #25
0
        /// <summary>
        /// Locates and returns a specific SIP Domain resource
        /// </summary>
        /// <param name="domainSid">The Sid of the SIP Domain to locate</param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public virtual void GetDomain(string domainSid, Action<Domain> callback)
        {
            var request = new RestRequest();
            request.Resource = "Accounts/{AccountSid}/SIP/Domains/{DomainSid}.json";
            request.AddUrlSegment("DomainSid", domainSid);

            ExecuteAsync<Domain>(request, (response) => callback(response));
        }
Пример #26
0
        public virtual async Task<VoiceCountry> GetVoiceCountryAsync(string isoCountry)
        {
            var request = new RestRequest(Method.GET);
            request.Resource = "Voice/Countries/{IsoCountry}";
            request.AddUrlSegment("IsoCountry", isoCountry);

            return await Execute<VoiceCountry>(request);
        }
Пример #27
0
 /// <summary>
 /// List all media for a particular message
 /// </summary>
 /// <param name="messageSid">The message sid to filter on</param>
 /// <param name="options"></param>
 public virtual async Task<MediaResult> ListMessageMediaAsync(string messageSid, MediaListRequest options)
 {
     var request = new RestRequest();
     request.Resource = "Accounts/{AccountSid}/Messages/{MessageSid}/Media.json";
     request.AddUrlSegment("MessageSid", messageSid);
     AddMediaListOptions(options, request);
     return await Execute<MediaResult>(request);
 }
Пример #28
0
        public virtual void GetVoiceNumber(string number, Action<VoiceNumber> callback)
        {
            var request = new RestRequest(Method.GET);
            request.Resource = "Voice/Numbers/{Number}";
            request.AddUrlSegment("Number", number);

            ExecuteAsync<VoiceNumber>(request, (response) => callback(response));
        }
Пример #29
0
 /// <summary>
 /// List all media for a particular message
 /// </summary>
 /// <param name="messageSid">The message sid to filter on</param>
 /// <param name="options"></param>
 /// <param name="callback"></param>
 public virtual void ListMessageMedia(string messageSid, MediaListRequest options, Action<MediaResult> callback)
 {
     var request = new RestRequest();
     request.Resource = "Accounts/{AccountSid}/Messages/{MessageSid}/Media.json";
     request.AddUrlSegment("MessageSid", messageSid);
     AddMediaListOptions(options, request);
     ExecuteAsync<MediaResult>(request, (response) => callback(response));
 }
Пример #30
0
        public virtual void GetVoiceCountry(string isoCountry, Action<VoiceCountry> callback)
        {
            var request = new RestRequest(Method.GET);
            request.Resource = "Voice/Countries/{IsoCountry}";
            request.AddUrlSegment("IsoCountry", isoCountry);

            ExecuteAsync<VoiceCountry>(request, (response) => callback(response));
        }