@devopness/sdk-js 2.75.0 → 2.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * devopness API
3
+ * Devopness API - Painless essential DevOps to everyone
4
+ *
5
+ * The version of the OpenAPI document: latest
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { ApiBaseService } from "../../../services/ApiBaseService";
13
+ import { ApiResponse } from "../../../common/ApiResponse";
14
+ import { Hook } from '../../generated/models';
15
+ import { HookPipelineCreate } from '../../generated/models';
16
+ import { HookRelation } from '../../generated/models';
17
+ /**
18
+ * PipelinesHooksApiService - Auto-generated
19
+ */
20
+ export declare class PipelinesHooksApiService extends ApiBaseService {
21
+ /**
22
+ *
23
+ * @summary Create a hook to a specific pipeline
24
+ * @param {string} hookType The hook type.
25
+ * @param {number} pipelineId The ID of the pipeline that will be executed by the created action
26
+ * @param {HookPipelineCreate} hookPipelineCreate A JSON object containing the resource data
27
+ */
28
+ addPipelineHook(hookType: string, pipelineId: number, hookPipelineCreate: HookPipelineCreate): Promise<ApiResponse<Hook>>;
29
+ /**
30
+ *
31
+ * @summary List all hooks in an pipeline
32
+ * @param {number} pipelineId The ID of the pipeline.
33
+ * @param {number} [page] Number of the page to be retrieved
34
+ * @param {number} [perPage] Number of items returned per page
35
+ */
36
+ listPipelineHooks(pipelineId: number, page?: number, perPage?: number): Promise<ApiResponse<Array<HookRelation>>>;
37
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /**
4
+ * devopness API
5
+ * Devopness API - Painless essential DevOps to everyone
6
+ *
7
+ * The version of the OpenAPI document: latest
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.PipelinesHooksApiService = void 0;
25
+ const ApiBaseService_1 = require("../../../services/ApiBaseService");
26
+ const ApiResponse_1 = require("../../../common/ApiResponse");
27
+ const Exceptions_1 = require("../../../common/Exceptions");
28
+ /**
29
+ * PipelinesHooksApiService - Auto-generated
30
+ */
31
+ class PipelinesHooksApiService extends ApiBaseService_1.ApiBaseService {
32
+ /**
33
+ *
34
+ * @summary Create a hook to a specific pipeline
35
+ * @param {string} hookType The hook type.
36
+ * @param {number} pipelineId The ID of the pipeline that will be executed by the created action
37
+ * @param {HookPipelineCreate} hookPipelineCreate A JSON object containing the resource data
38
+ */
39
+ addPipelineHook(hookType, pipelineId, hookPipelineCreate) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (hookType === null || hookType === undefined) {
42
+ throw new Exceptions_1.ArgumentNullException('hookType', 'addPipelineHook');
43
+ }
44
+ if (pipelineId === null || pipelineId === undefined) {
45
+ throw new Exceptions_1.ArgumentNullException('pipelineId', 'addPipelineHook');
46
+ }
47
+ if (hookPipelineCreate === null || hookPipelineCreate === undefined) {
48
+ throw new Exceptions_1.ArgumentNullException('hookPipelineCreate', 'addPipelineHook');
49
+ }
50
+ let queryString = '';
51
+ const requestUrl = '/pipelines/{pipeline_id}/hooks/{hook_type}' + (queryString ? `?${queryString}` : '');
52
+ const response = yield this.post(requestUrl.replace(`{${"hook_type"}}`, encodeURIComponent(String(hookType))).replace(`{${"pipeline_id"}}`, encodeURIComponent(String(pipelineId))), hookPipelineCreate);
53
+ return new ApiResponse_1.ApiResponse(response);
54
+ });
55
+ }
56
+ /**
57
+ *
58
+ * @summary List all hooks in an pipeline
59
+ * @param {number} pipelineId The ID of the pipeline.
60
+ * @param {number} [page] Number of the page to be retrieved
61
+ * @param {number} [perPage] Number of items returned per page
62
+ */
63
+ listPipelineHooks(pipelineId, page, perPage) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ if (pipelineId === null || pipelineId === undefined) {
66
+ throw new Exceptions_1.ArgumentNullException('pipelineId', 'listPipelineHooks');
67
+ }
68
+ let queryString = '';
69
+ const queryParams = { page: page, per_page: perPage, };
70
+ for (const key in queryParams) {
71
+ if (queryParams[key] === undefined || queryParams[key] === null) {
72
+ continue;
73
+ }
74
+ queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`;
75
+ }
76
+ const requestUrl = '/pipelines/{pipeline_id}/hooks' + (queryString ? `?${queryString}` : '');
77
+ const response = yield this.get(requestUrl.replace(`{${"pipeline_id"}}`, encodeURIComponent(String(pipelineId))));
78
+ return new ApiResponse_1.ApiResponse(response);
79
+ });
80
+ }
81
+ }
82
+ exports.PipelinesHooksApiService = PipelinesHooksApiService;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * devopness API
3
+ * Devopness API - Painless essential DevOps to everyone
4
+ *
5
+ * The version of the OpenAPI document: latest
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { ActionType } from './action-type';
13
+ import { HookIncomingSettings } from './hook-incoming-settings';
14
+ import { HookOutgoingSettings } from './hook-outgoing-settings';
15
+ import { HookTriggerWhen } from './hook-trigger-when';
16
+ import { ResourceType } from './resource-type';
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface HookPipelineCreate
21
+ */
22
+ export interface HookPipelineCreate {
23
+ /**
24
+ * The name of the outgoing hook. Must not be greater than 60 characters.
25
+ * @type {string}
26
+ * @memberof HookPipelineCreate
27
+ */
28
+ name: string;
29
+ /**
30
+ *
31
+ * @type {ResourceType}
32
+ * @memberof HookPipelineCreate
33
+ */
34
+ resource_type: ResourceType;
35
+ /**
36
+ * The hooks\' resource ID.
37
+ * @type {number}
38
+ * @memberof HookPipelineCreate
39
+ */
40
+ resource_id: number;
41
+ /**
42
+ *
43
+ * @type {ActionType}
44
+ * @memberof HookPipelineCreate
45
+ */
46
+ action_type: ActionType;
47
+ /**
48
+ * Determines if the hook is currently active.
49
+ * @type {boolean}
50
+ * @memberof HookPipelineCreate
51
+ */
52
+ active?: boolean;
53
+ /**
54
+ * Tells if requests to this hook must only be accepted when a HTTP header is sent with a message authentication code ([HMAC](https://en.wikipedia.org/wiki/HMAC)) generated based on the secret provided by Devopness and shared by user with external sources. This field is required when <code>type</code> is <code>in</code>.
55
+ * @type {boolean}
56
+ * @memberof HookPipelineCreate
57
+ */
58
+ requires_secret?: boolean;
59
+ /**
60
+ * The cryptographic hash function to be used by Devopness when validating digitally signed incoming requests for hooks that require secret validation. This field is required when <code>requires_secret</code> is <code>true</code>. Must be one of <code>sha256</code> Must not be greater than 20 characters.
61
+ * @type {string}
62
+ * @memberof HookPipelineCreate
63
+ */
64
+ secret_algorithm?: string;
65
+ /**
66
+ * The name of the HTTP request header from which the request digital signature should be extracted. This field is required when <code>requires_secret</code> is <code>true</code>. Must not be greater than 64 characters.
67
+ * @type {string}
68
+ * @memberof HookPipelineCreate
69
+ */
70
+ secret_header_name?: string;
71
+ /**
72
+ *
73
+ * @type {HookTriggerWhen}
74
+ * @memberof HookPipelineCreate
75
+ */
76
+ trigger_when?: HookTriggerWhen;
77
+ /**
78
+ *
79
+ * @type {HookIncomingSettings | HookOutgoingSettings}
80
+ * @memberof HookPipelineCreate
81
+ */
82
+ settings?: HookIncomingSettings | HookOutgoingSettings;
83
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /**
4
+ * devopness API
5
+ * Devopness API - Painless essential DevOps to everyone
6
+ *
7
+ * The version of the OpenAPI document: latest
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -93,6 +93,12 @@ export interface HookRelation {
93
93
  * @memberof HookRelation
94
94
  */
95
95
  environment_id: number;
96
+ /**
97
+ * The ID of the pipeline executed by this hook
98
+ * @type {number}
99
+ * @memberof HookRelation
100
+ */
101
+ pipeline_id: number | null;
96
102
  /**
97
103
  *
98
104
  * @type {ResourceType}
@@ -94,6 +94,12 @@ export interface Hook {
94
94
  * @memberof Hook
95
95
  */
96
96
  environment_id: number;
97
+ /**
98
+ * The ID of the pipeline executed by this hook
99
+ * @type {number}
100
+ * @memberof Hook
101
+ */
102
+ pipeline_id: number | null;
97
103
  /**
98
104
  *
99
105
  * @type {ResourceType}
@@ -80,6 +80,7 @@ export * from './hook-incoming-settings';
80
80
  export * from './hook-outgoing-request-header';
81
81
  export * from './hook-outgoing-settings';
82
82
  export * from './hook-outgoing-trigger-when-condition';
83
+ export * from './hook-pipeline-create';
83
84
  export * from './hook-relation';
84
85
  export * from './hook-request';
85
86
  export * from './hook-request-relation';
@@ -96,6 +96,7 @@ __exportStar(require("./hook-incoming-settings"), exports);
96
96
  __exportStar(require("./hook-outgoing-request-header"), exports);
97
97
  __exportStar(require("./hook-outgoing-settings"), exports);
98
98
  __exportStar(require("./hook-outgoing-trigger-when-condition"), exports);
99
+ __exportStar(require("./hook-pipeline-create"), exports);
99
100
  __exportStar(require("./hook-relation"), exports);
100
101
  __exportStar(require("./hook-request"), exports);
101
102
  __exportStar(require("./hook-request-relation"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopness/sdk-js",
3
- "version": "2.75.0",
3
+ "version": "2.76.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },