Skip to content

Latest commit

 

History

History
290 lines (238 loc) · 9.48 KB

WebhooksApi.md

File metadata and controls

290 lines (238 loc) · 9.48 KB

Webhooks Methods

Method Description
CreateWebhook Create a Webhook
DeleteWebhook Delete Webhook By ID
GetWebhookById Get Webhook By ID
ListWebhooks List Webhooks
UpdateWebhook Update a Webhook

CreateWebhook

CreateWebhookResponseBody CreateWebhook (CreateWebhookRequestBody createWebhookRequestBody, CancellationToken cancellationToken = default)

CreateWebhookResponseBody CreateWebhook (HttpClient methodClient, CreateWebhookRequestBody createWebhookRequestBody, CancellationToken cancellationToken = default)

Create a Webhook

Create a webook for specific events in the environment.

Example

using System.Collections.Generic;
using System.Diagnostics;
using ShipEngineSDK;
using ShipEngineSDK.Model;

namespace Example
{
    public class CreateWebhookExample
    {
        public static async Task Main()
        {
            var shipEngine = new ShipEngine("api_key");
            var createWebhookRequestBody = new CreateWebhookRequestBody();

            try
            {
                // Create a Webhook
                CreateWebhookResponseBody result = await shipEngine.CreateWebhook(createWebhookRequestBody);
                Debug.WriteLine(result);
            }
            catch (ShipEngineException e)
            {
                Debug.Print("Exception when calling WebhooksApi.CreateWebhook: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
methodClient HttpClient The HttpClient instance to use for the request.
createWebhookRequestBody CreateWebhookRequestBody
cancellationToken CancellationToken The cancellation token to use for the request.

Return type

CreateWebhookResponseBody

DeleteWebhook

string DeleteWebhook (string webhookId, CancellationToken cancellationToken = default)

string DeleteWebhook (HttpClient methodClient, string webhookId, CancellationToken cancellationToken = default)

Delete Webhook By ID

Delete a webhook

Example

using System.Collections.Generic;
using System.Diagnostics;
using ShipEngineSDK;
using ShipEngineSDK.Model;

namespace Example
{
    public class DeleteWebhookExample
    {
        public static async Task Main()
        {
            var shipEngine = new ShipEngine("api_key");
            var webhookId = "webhookId_example";

            try
            {
                // Delete Webhook By ID
                string result = await shipEngine.DeleteWebhook(webhookId);
                Debug.WriteLine(result);
            }
            catch (ShipEngineException e)
            {
                Debug.Print("Exception when calling WebhooksApi.DeleteWebhook: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
methodClient HttpClient The HttpClient instance to use for the request.
webhookId string Webhook ID
cancellationToken CancellationToken The cancellation token to use for the request.

Return type

string

GetWebhookById

GetWebhookByIdResponseBody GetWebhookById (string webhookId, CancellationToken cancellationToken = default)

GetWebhookByIdResponseBody GetWebhookById (HttpClient methodClient, string webhookId, CancellationToken cancellationToken = default)

Get Webhook By ID

Retrieve individual webhook by an ID

Example

using System.Collections.Generic;
using System.Diagnostics;
using ShipEngineSDK;
using ShipEngineSDK.Model;

namespace Example
{
    public class GetWebhookByIdExample
    {
        public static async Task Main()
        {
            var shipEngine = new ShipEngine("api_key");
            var webhookId = "webhookId_example";

            try
            {
                // Get Webhook By ID
                GetWebhookByIdResponseBody result = await shipEngine.GetWebhookById(webhookId);
                Debug.WriteLine(result);
            }
            catch (ShipEngineException e)
            {
                Debug.Print("Exception when calling WebhooksApi.GetWebhookById: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
methodClient HttpClient The HttpClient instance to use for the request.
webhookId string Webhook ID
cancellationToken CancellationToken The cancellation token to use for the request.

Return type

GetWebhookByIdResponseBody

ListWebhooks

List<Webhook> ListWebhooks (CancellationToken cancellationToken = default)

List<Webhook> ListWebhooks (HttpClient methodClient, CancellationToken cancellationToken = default)

List Webhooks

List all webhooks currently enabled for the account.

Example

using System.Collections.Generic;
using System.Diagnostics;
using ShipEngineSDK;
using ShipEngineSDK.Model;

namespace Example
{
    public class ListWebhooksExample
    {
        public static async Task Main()
        {
            var shipEngine = new ShipEngine("api_key");

            try
            {
                // List Webhooks
                List<Webhook> result = await shipEngine.ListWebhooks();
                Debug.WriteLine(result);
            }
            catch (ShipEngineException e)
            {
                Debug.Print("Exception when calling WebhooksApi.ListWebhooks: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
methodClient HttpClient The HttpClient instance to use for the request.
cancellationToken CancellationToken The cancellation token to use for the request.

Return type

List<Webhook>

UpdateWebhook

string UpdateWebhook (UpdateWebhookRequestBody updateWebhookRequestBody, string webhookId, CancellationToken cancellationToken = default)

string UpdateWebhook (HttpClient methodClient, UpdateWebhookRequestBody updateWebhookRequestBody, string webhookId, CancellationToken cancellationToken = default)

Update a Webhook

Update the webhook url property

Example

using System.Collections.Generic;
using System.Diagnostics;
using ShipEngineSDK;
using ShipEngineSDK.Model;

namespace Example
{
    public class UpdateWebhookExample
    {
        public static async Task Main()
        {
            var shipEngine = new ShipEngine("api_key");
            var updateWebhookRequestBody = new UpdateWebhookRequestBody();
            var webhookId = "webhookId_example";

            try
            {
                // Update a Webhook
                string result = await shipEngine.UpdateWebhook(updateWebhookRequestBody, webhookId);
                Debug.WriteLine(result);
            }
            catch (ShipEngineException e)
            {
                Debug.Print("Exception when calling WebhooksApi.UpdateWebhook: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
methodClient HttpClient The HttpClient instance to use for the request.
updateWebhookRequestBody UpdateWebhookRequestBody
webhookId string Webhook ID
cancellationToken CancellationToken The cancellation token to use for the request.

Return type

string