openapi: 3.0.0
info:
  title: Message Delivery
  description: Everything about Delivery Issues
servers:
  - url: https://rest.clicksend.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    delivery_issue:
      type: object
      properties:
        issue_id:
          type: string
          description: The unique identifier of the delivery issue.
          example: 1
        user_id:
          type: integer
          description: The unique identifier of the user.
          example: 3820
        message_id:
          type: string
          description: The message id of the message.
          example: B388828B-AD46-4366-8AD3-0305FF5E3FE5
        type:
          type: string
          description: >-
            The type of message, must be one of the following values SMS, MMS,
            VOICE, EMAIL_MARKETING, EMAIL_TRANSACTIONAL, FAX, POST.
          example: sms
        description:
          type: string
          description: The description of the message.
          example: Test message
        client_comments:
          nullable: true
          type: string
          description: The user's comments.
        support_comments:
          nullable: true
          type: string
          description: The support's comments.
        status:
          nullable: true
          type: string
          description: The status of the delivery issue.
        date_added:
          type: number
          description: The date and time the delivery issue was created.
          example: 1590000000
        resolved:
          type: number
          description: Flag indicating if the delivery issue is resolved.
          example: 0
        email-address:
          type: string
          description: The user's email address.
          example: johndoe1@awesome.com
    get-all-delivery-issues:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: Here is your result.
        data:
          type: array
          items:
            $ref: '#/components/schemas/delivery_issue'
          example:
            - issue_id: 1
              user_id: 3820
              message_id: B388828B-AD46-4366-8AD3-0305FF5E3FE5
              type: sms
              description: this is a test.
              client_comments: null
              support_comments: null
              status: null
              date_added: 1481610495
              resolved: 0
              email_address: test@user.com
            - issue_id: 2
              user_id: 3820
              message_id: 90396A38-146B-46C4-A455-675F620C2E05
              type: sms
              description: this is a test.
              client_comments: null
              support_comments: null
              status: null
              date_added: 1481610495
              resolved: 0
              email_address: test@user.com
            - issue_id: 3
              user_id: 3820
              message_id: 4ECFB6CB-0300-45EC-96E1-5AB189432AF5
              type: sms
              description: this is a test.
              client_comments: null
              support_comments: null
              status: null
              date_added: 1481611389
              resolved: 0
              email_address: test@user.com
    create-delivery-issue:
      type: object
      properties:
        http_code:
          type: integer
          description: The HTTP status code of the response.
          example: 200
        response_code:
          type: string
          description: The response code indicating the status of the operation.
          example: SUCCESS
        response_msg:
          type: string
          description: A message describing the outcome of the operation.
          example: New delivery issue has been created.
        data:
          type: object
          properties:
            issue_id:
              type: integer
              description: The ID of the created delivery issue.
              example: 1
            user_id:
              type: integer
              description: The ID of the user who created the delivery issue.
              example: 3820
            message_id:
              type: string
              description: The ID of the message associated with the delivery issue.
              example: B388828B-AD46-4366-8AD3-0305FF5E3FE5
            type:
              type: string
              description: The type of delivery issue.
              example: sms
            description:
              type: string
              description: The description of the delivery issue.
              example: this is a test.
            date_added:
              type: integer
              description: The timestamp of when the delivery issue was created.
              example: 1481610495
            email_address:
              type: string
              description: The email address associated with the delivery issue.
              example: test@user.com
paths:
  /v3/delivery-issues:
    get:
      summary: Get All Delivery Issues
      operationId: get-all-delivery-issues
      description: >-
        _Get all delivery issues_


        Get all delivery issues


        ### Parameters


        | Parameter | In | Type | Required | Description |

        | --- | --- | --- | --- | --- |

        | page | query | integer(int32) | false | Page number |

        | limit | query | integer(int32) | false | Number of records per page |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-all-delivery-issues'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
            'https://rest.clicksend.com/v3/delivery-issues'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\DeliveryIssuesApi(new
            GuzzleHttp\Client(),$config);

            $page = 1; // int | Page number

            $limit = 10; // int | Number of records per page


            try {
                $result = $apiInstance->deliveryIssuesGet($page, $limit);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling DeliveryIssuesApi->deliveryIssuesGet: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: |-
            using IO.ClickSend.ClickSend.Api;
            using IO.ClickSend.Client;
            using IO.ClickSend.ClickSend.Model;

            var configuration = new Configuration()
            {
                Username = USERNAME, 
                Password = API_KEY  
            };
            var deliveryIssuesApi = new DeliveryIssuesApi(configuration);
            var response = deliveryIssuesApi.DeliveryIssuesGet();
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.DeliveryIssuesApi;

            public class view_delivery_issues {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                DeliveryIssuesApi apiInstance = new DeliveryIssuesApi(defaultClient);
                Integer page = 1; // Integer | Page number
                Integer limit = 10; // Integer | Number of records per page
                try {
                    String result = apiInstance.deliveryIssuesGet(page, limit);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling DeliveryIssuesApi#deliveryIssuesGet");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var deliveryIssuesApi = new api.DeliveryIssuesApi("USERNAME",
            "API_KEY");


            var page = 1;

            var limit = 10;


            deliveryIssuesApi.deliveryIssuesGet(page,
            limit).then(function(response) {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::DeliveryIssuesApi.new

            opts = {
              page: 1,  # Integer | Page number
              limit: 10 # Integer | Number of records per page
            }

            begin
              # Get all delivery issues
              result = api_instance.delivery_issues_get(opts)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling DeliveryIssuesApi->delivery_issues_get: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.DeliveryIssuesApi(clicksend_client.ApiClient(configuration))

            page = 1 # int | Page number (optional) (default to 1)

            limit = 10 # int | Number of records per page (optional) (default to
            10)


            try:
                # Get all delivery issues
                api_response = api_instance.delivery_issues_get(page=page, limit=limit)
                print(api_response)
            except ApiException as e:
                print("Exception when calling DeliveryIssuesApi->delivery_issues_get: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::DeliveryIssuesApi;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::DeliveryIssuesApi->new(username =>
            $username, password => $password);


            my $json_output = $api->delivery_issues_get('page' => '1', 'limit'
            => '10');


            print $json_output;
        - lang: objc
          source: >-
            #import "CSDeliveryIssuesApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];


            NSNumber *page = [[NSNumber alloc] initWithInt:1];

            NSNumber *limit = [[NSNumber alloc] initWithInt:15];


            CSDeliveryIssuesApi *deliveryIssuesApiInstance =
            [[CSDeliveryIssuesApi alloc] init];

            [deliveryIssuesApiInstance deliveryIssuesGetWithPage:page
            limit:limit completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }

            DeliveryIssuesAPI.deliveryIssuesGet { (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
    post:
      summary: Create Delivery Issues
      operationId: create-delivery-issue
      description: >-
        _Create delivery Issue_


        Create delivery Issue


        ### Properties


        | Name | Type | Required | Restrictions | Description |

        | --- | --- | --- | --- | --- |

        | message_id | string | false | none | The message id of the message. |

        | type | string | true | none | The type of message, must be one of the
        following values SMS, MMS, VOICE, EMAIL_MARKETING, EMAIL_TRANSACTIONAL,
        FAX, POST. |

        | description | string | true | none | The description of the message. |

        | client_comments | string | false | none | The user's comments. |

        | email-address | string | true | none | The user's email address. |



        Refer to [Status Codes](/#status-codes) for definitions of HTTP status
        code responses.



        <div style="background-color: #FF6A4B; padding: 10px; border-radius:
        8px;">
          <span style="color: white;">This endpoint requires authentication,</span> 
          <a href="/#authentication" style="color: white; text-decoration: underline;">more info...</a>
        </div>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                message_id:
                  type: string
                type:
                  type: string
                description:
                  type: string
                email_address:
                  type: string
                client_comments:
                  type: string
                support_comments:
                  type: string
                resolved:
                  type: boolean
              example:
                message_id: '{{message_id}}'
                type: EMAIL_MARKETING
                description: test
                email_address: test@test.com
                client_comments: test
                support_comments: test
                resolved: true
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create-delivery-issue'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --include \
                 --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA=="  \
                 --request POST \
                 --header "Content-Type: application/json" \
                 --data-binary "{
              \"message_id\": \"B388828B-AD46-4366-8AD3-0305FF5E3FE5\",
              \"type\": \"SMS\",
              \"description\": \"This is a test\",
              \"client_comments\": \"test\",
              \"email_address\": \"john_doe@user.com\"
            }" \
            'https://rest.clicksend.com/v3/delivery-issues'
        - lang: PHP
          source: >-
            <?php

            require_once(__DIR__ . '/vendor/autoload.php');


            // Configure HTTP basic authorization: BasicAuth

            $config = ClickSend\Configuration::getDefaultConfiguration()
                          ->setUsername('USERNAME')
                          ->setPassword('API_KEY');

            $apiInstance = new ClickSend\Api\DeliveryIssuesApi(new
            GuzzleHttp\Client(),$config);

            $delivery_issue = new \ClickSend\Model\DeliveryIssue(); //
            \ClickSend\Model\DeliveryIssue | DeliveryIssue model

            $delivery_issue->setMessageId("B388828B-AD46-4366-8AD3-0305FF5E3FE5");

            $delivery_issue->setType("SMS");

            $delivery_issue->setDescription("This is a test");

            $delivery_issue->setClientComments("test");

            $delivery_issue->setEmailAddress("john_doe@user.com");

            try {
                $result = $apiInstance->deliveryIssuesPost($delivery_issue);
                print_r($result);
            } catch (Exception $e) {
                echo 'Exception when calling DeliveryIssuesApi->deliveryIssuesPost: ', $e->getMessage(), PHP_EOL;
            }

            ?>
        - lang: C#
          source: >-
            using IO.ClickSend.ClickSend.Api;

            using IO.ClickSend.Client;

            using IO.ClickSend.ClickSend.Model;


            var configuration = new Configuration()

            {
                Username = USERNAME, 
                Password = API_KEY  
            };

            var deliveryIssuesApi = new DeliveryIssuesApi(configuration);

            var response = deliveryIssuesApi.DeliveryIssuesPost(new
            DeliveryIssue(
                messageId: "MESSAGE_ID",
                type: "MESSAGE_TYPE",
                description: "DESCRIPTION",
                clientComments: "CLIENT_COMMENTS",
                emailAddress: "EMAIL_ID"
            ));
        - lang: Java
          source: |-
            package ClickSend;

            import ClickSend.Api.DeliveryIssuesApi;
            import ClickSend.Model.DeliveryIssue;

            public class create_delivery_issue {
              public static void main(String[] args) {
                ApiClient defaultClient = new ApiClient();
                defaultClient.setUsername("USERNAME");
                defaultClient.setPassword("API_KEY");
                DeliveryIssuesApi apiInstance = new DeliveryIssuesApi(defaultClient);
                // DeliveryIssue | DeliveryIssue model
                DeliveryIssue deliveryIssue = new DeliveryIssue();
                deliveryIssue.messageId("B388828B-AD46-4366-8AD3-0305FF5E3FTY");
                deliveryIssue.type("SMS");
                deliveryIssue.description("testing");
                deliveryIssue.clientComments("test");
                deliveryIssue.emailAddress("xxx@gmail.com");
                try {
                    String result = apiInstance.deliveryIssuesPost(deliveryIssue);
                    System.out.println(result);
                } catch (ApiException e) {
                    System.err.println("Exception when calling DeliveryIssuesApi#deliveryIssuesPost");
                    e.printStackTrace();
                }
              }
            }
        - lang: Node.js
          source: >-
            var api = require('./api.js');


            var deliveryIssuesApi = new api.DeliveryIssuesApi("USERNAME",
            "API_KEY");


            var deliveryIssue = new api.DeliveryIssue();


            deliveryIssue.messageId = "message_id";

            deliveryIssue.type = "SMS";

            deliveryIssue.description = "This is a test";

            deliveryIssue.clientComments = "comment";

            deliveryIssue.emailAddress = "xxx@gmail.com";


            deliveryIssuesApi.deliveryIssuesPost(deliveryIssue).then(function(response)
            {
              console.log(response.body);
            }).catch(function(err){
              console.error(err.body);
            });
        - lang: Ruby
          source: |-
            # load the gem
            require 'clicksend_client'
            require 'json'

            # setup authorization
            ClickSendClient.configure do |config|
              # Configure HTTP basic authorization: BasicAuth
              config.username = 'USERNAME'
              config.password = 'API_KEY'
            end

            api_instance = ClickSendClient::DeliveryIssuesApi.new

            # DeliveryIssue | DeliveryIssue model
            delivery_issue = ClickSendClient::DeliveryIssue.new(
              "client_comments": "client_comments",
              "description": "description",
              "message_id": "message_id",
              "type": "type",
              "email_address": "email_address"
            )

            begin
              # Create delivery Issue
              result = api_instance.delivery_issues_post(delivery_issue)
              p JSON.parse(result)
            rescue ClickSendClient::ApiError => e
              puts "Exception when calling DeliveryIssuesApi->delivery_issues_post: #{e.response_body}"
            end
        - lang: Python
          source: >-
            from __future__ import print_function

            import clicksend_client

            from clicksend_client.rest import ApiException


            # Configure HTTP basic authorization: BasicAuth

            configuration = clicksend_client.Configuration()

            configuration.username = 'USERNAME'

            configuration.password = 'API_KEY'


            # create an instance of the API class

            api_instance =
            clicksend_client.DeliveryIssuesApi(clicksend_client.ApiClient(configuration))

            # DeliveryIssue | DeliveryIssue model

            delivery_issue = clicksend_client.DeliveryIssue(
                              message_id='B388828B-AD46-4366-8AD3-0305FF5E3FE5',
                              type='SMS',
                              description='This is a test',
                              client_comments='test',
                              email_address= 'john_doe@user.com') 

            try:
                # Create delivery Issue
                api_response = api_instance.delivery_issues_post(delivery_issue)
                print(api_response)
            except ApiException as e:
                print("Exception when calling DeliveryIssuesApi->delivery_issues_post: %s\n" % e)
        - lang: perl
          source: >-
            use WWW::ClickSendClient::DeliveryIssuesApi;

            use WWW::ClickSendClient::Object::DeliveryIssue;


            my $username = 'YOUR_API_USER_NAME';

            my $password = 'YOUR_API_PASSWORD';


            my $api = WWW::ClickSendClient::DeliveryIssuesApi->new(username =>
            $username, password => $password);


            my %params = (
                'message_id'      => 'message_id',
                'type'            => 'SMS',
                'description'     => 'description',
                'client_comments' => 'client_comments',
                'email_address'   => 'test1@test.com'
            );


            my $delivery_issue_obj =
            WWW::ClickSendClient::Object::DeliveryIssue->new(%params);

            my $json_output = $api->delivery_issues_post('delivery_issue' =>
            $delivery_issue_obj);


            print $json_output;
        - lang: objc
          source: >-
            #import "CSDeliveryIssuesApi.h"


            CSDefaultConfiguration *apiConfig = [CSDefaultConfiguration
            sharedConfig];

            [apiConfig setUsername:@"USERNAME"];

            [apiConfig setPassword:@"PASSWORD"];



            CSDeliveryIssue *deliveryIssue = [[CSDeliveryIssue alloc] init];

            deliveryIssue.messageId = @"message_id";

            deliveryIssue.type = @"SMS";

            deliveryIssue._description = @"description";

            deliveryIssue.clientComments = @"client_comments";

            deliveryIssue.emailAddress = @"email_address";


            CSDeliveryIssuesApi *deliveryIssuesApiInstance =
            [[CSDeliveryIssuesApi alloc] init];

            [deliveryIssuesApiInstance
            deliveryIssuesPostWithDeliveryIssue:deliveryIssue
            completionHandler:^(NSString *output, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    NSLog(@"%@", output);
                }
            }];
        - lang: swift
          source: >-
            import Alamofire


            if let authHeader = Request.authorizationHeader(user: "USERNAME",
            password: "PASSWORD") {
                ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
            }

            let deliveryIssue = DeliveryIssue(
                                    messageId: "messageId", 
                                    type: "SMS", 
                                    _description: "desciption", 
                                    clientComments: "clientcomments", 
                                    emailAddress: "emailAddress"
                                )
            DeliveryIssuesAPI.deliveryIssuesPost(deliveryIssue: deliveryIssue) {
            (dataString, error) in
                guard let dataString = dataString else {
                    print(error!)
                    return
                }
                if let data = dataString.data(using: String.Encoding.utf8) {
                    do {
                        if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
                            print(dictonary)
                        } else {
                            print("Cannot convert the String value to JSON")
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                }
            }
