UNPKG

@devopness/sdk-js

Version:

Devopness API JS/TS SDK - Painless essential DevOps to everyone

114 lines (113 loc) 5.42 kB
"use strict"; /* eslint-disable */ /** * devopness API * Devopness API - Painless essential DevOps to everyone * * The version of the OpenAPI document: latest * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HooksApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * HooksApiService - Auto-generated */ class HooksApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Delete a given hook * @param {string} hookId The ID of the hook. * @param {HookTypeParam} hookType The type of the hook. */ deleteHook(hookId, hookType) { return __awaiter(this, void 0, void 0, function* () { if (hookId === null || hookId === undefined) { throw new Exceptions_1.ArgumentNullException('hookId', 'deleteHook'); } if (hookType === null || hookType === undefined) { throw new Exceptions_1.ArgumentNullException('hookType', 'deleteHook'); } let queryString = ''; const requestUrl = '/hooks/{hook_type}/{hook_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"hook_id"}}`, encodeURIComponent(String(hookId))).replace(`{${"hook_type"}}`, encodeURIComponent(String(hookType)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get a hook by ID * @param {string} hookId The ID of the hook. * @param {HookTypeParam} hookType The type of the hook. */ getHook(hookId, hookType) { return __awaiter(this, void 0, void 0, function* () { if (hookId === null || hookId === undefined) { throw new Exceptions_1.ArgumentNullException('hookId', 'getHook'); } if (hookType === null || hookType === undefined) { throw new Exceptions_1.ArgumentNullException('hookType', 'getHook'); } let queryString = ''; const requestUrl = '/hooks/{hook_type}/{hook_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"hook_id"}}`, encodeURIComponent(String(hookId))).replace(`{${"hook_type"}}`, encodeURIComponent(String(hookType)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Trigger an incoming hook associated action * @param {string} hookId The ID of the hook. */ triggerHook(hookId) { return __awaiter(this, void 0, void 0, function* () { if (hookId === null || hookId === undefined) { throw new Exceptions_1.ArgumentNullException('hookId', 'triggerHook'); } let queryString = ''; const requestUrl = '/hooks/{hook_id}/trigger' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"hook_id"}}`, encodeURIComponent(String(hookId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing hook * @param {string} hookId The ID of the hook. * @param {HookTypeParam} hookType The type of the hook. * @param {HookUpdate} hookUpdate A JSON object containing the resource data */ updateHook(hookId, hookType, hookUpdate) { return __awaiter(this, void 0, void 0, function* () { if (hookId === null || hookId === undefined) { throw new Exceptions_1.ArgumentNullException('hookId', 'updateHook'); } if (hookType === null || hookType === undefined) { throw new Exceptions_1.ArgumentNullException('hookType', 'updateHook'); } if (hookUpdate === null || hookUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('hookUpdate', 'updateHook'); } let queryString = ''; const requestUrl = '/hooks/{hook_type}/{hook_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"hook_id"}}`, encodeURIComponent(String(hookId))).replace(`{${"hook_type"}}`, encodeURIComponent(String(hookType))), hookUpdate); return new ApiResponse_1.ApiResponse(response); }); } } exports.HooksApiService = HooksApiService;