# All files / codegen/apis WebhooksApi.ts

45.27% Statements 91/201
100% Branches 0/0
0% Functions 0/8
45.27% Lines 91/201

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    2021x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x
     /* tslint:disable */
    /* eslint-disable */
    /**
     * Octane API
     * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
     *
     * The version of the OpenAPI document: 1.0.0
     *
     *
     * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
     * https://openapi-generator.tech
     * Do not edit the class manually.
     */

    import * as runtime from '../runtime';
    import {
        CreateWebhookArgs,
        CreateWebhookArgsFromJSON,
        CreateWebhookArgsToJSON,
        Webhook,
        WebhookFromJSON,
        WebhookToJSON,
    } from '../models';

    export interface WebhooksPostRequest {
        createWebhookArgs: CreateWebhookArgs;
    }

    export interface WebhooksUuidDeleteRequest {
        uuid: string;
    }

    export interface WebhooksUuidGetRequest {
        uuid: string;
    }

    /**
     *
     */
    export class WebhooksApi extends runtime.BaseAPI {

        /**
         * Get all Webhooks for a given Vendor.
         * Get Webhooks
         */
        async webhooksGetRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<Array<Webhook>>> {
            const queryParameters: any = {};

            const headerParameters: runtime.HTTPHeaders = {};

            if (this.configuration && this.configuration.accessToken) {
                const token = this.configuration.accessToken;
                const tokenString = await token("BearerApiKeyAuth", []);

                if (tokenString) {
                    headerParameters["Authorization"] = `Bearer ${tokenString}`;
                }
            }
            const response = await this.request({
                path: `/webhooks/`,
                method: 'GET',
                headers: headerParameters,
                query: queryParameters,
            }, initOverrides);

            return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(WebhookFromJSON));
        }

        /**
         * Get all Webhooks for a given Vendor.
         * Get Webhooks
         */
        async webhooksGet(initOverrides?: RequestInit): Promise<Array<Webhook>> {
            const response = await this.webhooksGetRaw(initOverrides);
            return await response.value();
        }

        /**
         * Add an endpoint to use with Octane\'s Webhook API.
         * Add Webhook
         */
        async webhooksPostRaw(requestParameters: WebhooksPostRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Webhook>> {
            if (requestParameters.createWebhookArgs === null || requestParameters.createWebhookArgs === undefined) {
                throw new runtime.RequiredError('createWebhookArgs','Required parameter requestParameters.createWebhookArgs was null or undefined when calling webhooksPost.');
            }

            const queryParameters: any = {};

            const headerParameters: runtime.HTTPHeaders = {};

            headerParameters['Content-Type'] = 'application/json';

            if (this.configuration && this.configuration.accessToken) {
                const token = this.configuration.accessToken;
                const tokenString = await token("BearerApiKeyAuth", []);

                if (tokenString) {
                    headerParameters["Authorization"] = `Bearer ${tokenString}`;
                }
            }
            const response = await this.request({
                path: `/webhooks/`,
                method: 'POST',
                headers: headerParameters,
                query: queryParameters,
                body: CreateWebhookArgsToJSON(requestParameters.createWebhookArgs),
            }, initOverrides);

            return new runtime.JSONApiResponse(response, (jsonValue) => WebhookFromJSON(jsonValue));
        }

        /**
         * Add an endpoint to use with Octane\'s Webhook API.
         * Add Webhook
         */
        async webhooksPost(requestParameters: WebhooksPostRequest, initOverrides?: RequestInit): Promise<Webhook> {
            const response = await this.webhooksPostRaw(requestParameters, initOverrides);
            return await response.value();
        }

        /**
         * Delete and unregister a webhook URL given its UUID.
         * Delete Webhook
         */
        async webhooksUuidDeleteRaw(requestParameters: WebhooksUuidDeleteRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
            if (requestParameters.uuid === null || requestParameters.uuid === undefined) {
                throw new runtime.RequiredError('uuid','Required parameter requestParameters.uuid was null or undefined when calling webhooksUuidDelete.');
            }

            const queryParameters: any = {};

            const headerParameters: runtime.HTTPHeaders = {};

            if (this.configuration && this.configuration.accessToken) {
                const token = this.configuration.accessToken;
                const tokenString = await token("BearerApiKeyAuth", []);

                if (tokenString) {
                    headerParameters["Authorization"] = `Bearer ${tokenString}`;
                }
            }
            const response = await this.request({
                path: `/webhooks/{uuid}`.replace(`{${"uuid"}}`, encodeURIComponent(String(requestParameters.uuid))),
                method: 'DELETE',
                headers: headerParameters,
                query: queryParameters,
            }, initOverrides);

            return new runtime.VoidApiResponse(response);
        }

        /**
         * Delete and unregister a webhook URL given its UUID.
         * Delete Webhook
         */
        async webhooksUuidDelete(requestParameters: WebhooksUuidDeleteRequest, initOverrides?: RequestInit): Promise<void> {
            await this.webhooksUuidDeleteRaw(requestParameters, initOverrides);
        }

        /**
         * Retrieve a webhook given its UUID.
         * Get Webhook
         */
        async webhooksUuidGetRaw(requestParameters: WebhooksUuidGetRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Webhook>> {
            if (requestParameters.uuid === null || requestParameters.uuid === undefined) {
                throw new runtime.RequiredError('uuid','Required parameter requestParameters.uuid was null or undefined when calling webhooksUuidGet.');
            }

            const queryParameters: any = {};

            const headerParameters: runtime.HTTPHeaders = {};

            if (this.configuration && this.configuration.accessToken) {
                const token = this.configuration.accessToken;
                const tokenString = await token("BearerApiKeyAuth", []);

                if (tokenString) {
                    headerParameters["Authorization"] = `Bearer ${tokenString}`;
                }
            }
            const response = await this.request({
                path: `/webhooks/{uuid}`.replace(`{${"uuid"}}`, encodeURIComponent(String(requestParameters.uuid))),
                method: 'GET',
                headers: headerParameters,
                query: queryParameters,
            }, initOverrides);

            return new runtime.JSONApiResponse(response, (jsonValue) => WebhookFromJSON(jsonValue));
        }

        /**
         * Retrieve a webhook given its UUID.
         * Get Webhook
         */
        async webhooksUuidGet(requestParameters: WebhooksUuidGetRequest, initOverrides?: RequestInit): Promise<Webhook> {
            const response = await this.webhooksUuidGetRaw(requestParameters, initOverrides);
            return await response.value();
        }

    }