@cirrobio/api-client 0.1.13 → 0.1.14

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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install @cirrobio/api-client@0.1.13 --save
39
+ npm install @cirrobio/api-client@0.1.14 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -14,6 +14,11 @@ import type { CreateResponse, CustomPipelineSettings, FileRequirements, FormSche
14
14
  export interface ArchiveCustomProcessRequest {
15
15
  processId: string;
16
16
  }
17
+ export interface AuthorizeCustomProcessRequest {
18
+ processId: string;
19
+ code: string;
20
+ state: string;
21
+ }
17
22
  export interface CalculatePipelineCostRequest {
18
23
  processId: string;
19
24
  body: object;
@@ -55,6 +60,16 @@ export declare class ProcessesApi extends runtime.BaseAPI {
55
60
  * Archive custom process
56
61
  */
57
62
  archiveCustomProcess(requestParameters: ArchiveCustomProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
63
+ /**
64
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
65
+ * Authorize custom process
66
+ */
67
+ authorizeCustomProcessRaw(requestParameters: AuthorizeCustomProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
68
+ /**
69
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
70
+ * Authorize custom process
71
+ */
72
+ authorizeCustomProcess(requestParameters: AuthorizeCustomProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
58
73
  /**
59
74
  * Retrieves the cost of running the pipeline
60
75
  * Calculate pipeline cost
@@ -128,6 +128,71 @@ var ProcessesApi = /** @class */ (function (_super) {
128
128
  });
129
129
  });
130
130
  };
131
+ /**
132
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
133
+ * Authorize custom process
134
+ */
135
+ ProcessesApi.prototype.authorizeCustomProcessRaw = function (requestParameters, initOverrides) {
136
+ return __awaiter(this, void 0, void 0, function () {
137
+ var queryParameters, headerParameters, token, tokenString, response;
138
+ return __generator(this, function (_a) {
139
+ switch (_a.label) {
140
+ case 0:
141
+ if (requestParameters.processId === null || requestParameters.processId === undefined) {
142
+ throw new runtime.RequiredError('processId', 'Required parameter requestParameters.processId was null or undefined when calling authorizeCustomProcess.');
143
+ }
144
+ if (requestParameters.code === null || requestParameters.code === undefined) {
145
+ throw new runtime.RequiredError('code', 'Required parameter requestParameters.code was null or undefined when calling authorizeCustomProcess.');
146
+ }
147
+ if (requestParameters.state === null || requestParameters.state === undefined) {
148
+ throw new runtime.RequiredError('state', 'Required parameter requestParameters.state was null or undefined when calling authorizeCustomProcess.');
149
+ }
150
+ queryParameters = {};
151
+ if (requestParameters.code !== undefined) {
152
+ queryParameters['code'] = requestParameters.code;
153
+ }
154
+ if (requestParameters.state !== undefined) {
155
+ queryParameters['state'] = requestParameters.state;
156
+ }
157
+ headerParameters = {};
158
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
159
+ token = this.configuration.accessToken;
160
+ return [4 /*yield*/, token("accessToken", [])];
161
+ case 1:
162
+ tokenString = _a.sent();
163
+ if (tokenString) {
164
+ headerParameters["Authorization"] = "Bearer ".concat(tokenString);
165
+ }
166
+ _a.label = 2;
167
+ case 2: return [4 /*yield*/, this.request({
168
+ path: "/processes/{processId}:authorize".replace("{".concat("processId", "}"), encodeURIComponent(String(requestParameters.processId))),
169
+ method: 'PUT',
170
+ headers: headerParameters,
171
+ query: queryParameters,
172
+ }, initOverrides)];
173
+ case 3:
174
+ response = _a.sent();
175
+ return [2 /*return*/, new runtime.VoidApiResponse(response)];
176
+ }
177
+ });
178
+ });
179
+ };
180
+ /**
181
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
182
+ * Authorize custom process
183
+ */
184
+ ProcessesApi.prototype.authorizeCustomProcess = function (requestParameters, initOverrides) {
185
+ return __awaiter(this, void 0, void 0, function () {
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0: return [4 /*yield*/, this.authorizeCustomProcessRaw(requestParameters, initOverrides)];
189
+ case 1:
190
+ _a.sent();
191
+ return [2 /*return*/];
192
+ }
193
+ });
194
+ });
195
+ };
131
196
  /**
132
197
  * Retrieves the cost of running the pipeline
133
198
  * Calculate pipeline cost
@@ -52,6 +52,12 @@ export interface CustomPipelineSettings {
52
52
  * @memberof CustomPipelineSettings
53
53
  */
54
54
  commitHash?: string | null;
55
+ /**
56
+ * Whether we are authorized to access the repository
57
+ * @type {boolean}
58
+ * @memberof CustomPipelineSettings
59
+ */
60
+ isAuthorized?: boolean;
55
61
  }
56
62
  /**
57
63
  * Check if a given object implements the CustomPipelineSettings interface.
@@ -40,6 +40,7 @@ function CustomPipelineSettingsFromJSONTyped(json, ignoreDiscriminator) {
40
40
  'lastSync': !(0, runtime_1.exists)(json, 'lastSync') ? undefined : (json['lastSync'] === null ? null : new Date(json['lastSync'])),
41
41
  'syncStatus': !(0, runtime_1.exists)(json, 'syncStatus') ? undefined : (0, SyncStatus_1.SyncStatusFromJSON)(json['syncStatus']),
42
42
  'commitHash': !(0, runtime_1.exists)(json, 'commitHash') ? undefined : json['commitHash'],
43
+ 'isAuthorized': !(0, runtime_1.exists)(json, 'isAuthorized') ? undefined : json['isAuthorized'],
43
44
  };
44
45
  }
45
46
  exports.CustomPipelineSettingsFromJSONTyped = CustomPipelineSettingsFromJSONTyped;
@@ -57,6 +58,7 @@ function CustomPipelineSettingsToJSON(value) {
57
58
  'lastSync': value.lastSync === undefined ? undefined : (value.lastSync === null ? null : value.lastSync.toISOString()),
58
59
  'syncStatus': (0, SyncStatus_1.SyncStatusToJSON)(value.syncStatus),
59
60
  'commitHash': value.commitHash,
61
+ 'isAuthorized': value.isAuthorized,
60
62
  };
61
63
  }
62
64
  exports.CustomPipelineSettingsToJSON = CustomPipelineSettingsToJSON;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cirrobio/api-client",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "API client for Cirro",
5
5
  "author": "CirroBio",
6
6
  "repository": {
@@ -53,6 +53,12 @@ export interface ArchiveCustomProcessRequest {
53
53
  processId: string;
54
54
  }
55
55
 
56
+ export interface AuthorizeCustomProcessRequest {
57
+ processId: string;
58
+ code: string;
59
+ state: string;
60
+ }
61
+
56
62
  export interface CalculatePipelineCostRequest {
57
63
  processId: string;
58
64
  body: object;
@@ -132,6 +138,61 @@ export class ProcessesApi extends runtime.BaseAPI {
132
138
  await this.archiveCustomProcessRaw(requestParameters, initOverrides);
133
139
  }
134
140
 
141
+ /**
142
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
143
+ * Authorize custom process
144
+ */
145
+ async authorizeCustomProcessRaw(requestParameters: AuthorizeCustomProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
146
+ if (requestParameters.processId === null || requestParameters.processId === undefined) {
147
+ throw new runtime.RequiredError('processId','Required parameter requestParameters.processId was null or undefined when calling authorizeCustomProcess.');
148
+ }
149
+
150
+ if (requestParameters.code === null || requestParameters.code === undefined) {
151
+ throw new runtime.RequiredError('code','Required parameter requestParameters.code was null or undefined when calling authorizeCustomProcess.');
152
+ }
153
+
154
+ if (requestParameters.state === null || requestParameters.state === undefined) {
155
+ throw new runtime.RequiredError('state','Required parameter requestParameters.state was null or undefined when calling authorizeCustomProcess.');
156
+ }
157
+
158
+ const queryParameters: any = {};
159
+
160
+ if (requestParameters.code !== undefined) {
161
+ queryParameters['code'] = requestParameters.code;
162
+ }
163
+
164
+ if (requestParameters.state !== undefined) {
165
+ queryParameters['state'] = requestParameters.state;
166
+ }
167
+
168
+ const headerParameters: runtime.HTTPHeaders = {};
169
+
170
+ if (this.configuration && this.configuration.accessToken) {
171
+ const token = this.configuration.accessToken;
172
+ const tokenString = await token("accessToken", []);
173
+
174
+ if (tokenString) {
175
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
176
+ }
177
+ }
178
+ const response = await this.request({
179
+ path: `/processes/{processId}:authorize`.replace(`{${"processId"}}`, encodeURIComponent(String(requestParameters.processId))),
180
+ method: 'PUT',
181
+ headers: headerParameters,
182
+ query: queryParameters,
183
+ }, initOverrides);
184
+
185
+ return new runtime.VoidApiResponse(response);
186
+ }
187
+
188
+ /**
189
+ * Authorizes the GitHub repository connection for the process (only for private repositories)
190
+ * Authorize custom process
191
+ */
192
+ async authorizeCustomProcess(requestParameters: AuthorizeCustomProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
193
+ await this.authorizeCustomProcessRaw(requestParameters, initOverrides);
194
+ }
195
+
135
196
  /**
136
197
  * Retrieves the cost of running the pipeline
137
198
  * Calculate pipeline cost
@@ -62,6 +62,12 @@ export interface CustomPipelineSettings {
62
62
  * @memberof CustomPipelineSettings
63
63
  */
64
64
  commitHash?: string | null;
65
+ /**
66
+ * Whether we are authorized to access the repository
67
+ * @type {boolean}
68
+ * @memberof CustomPipelineSettings
69
+ */
70
+ isAuthorized?: boolean;
65
71
  }
66
72
 
67
73
  /**
@@ -90,6 +96,7 @@ export function CustomPipelineSettingsFromJSONTyped(json: any, ignoreDiscriminat
90
96
  'lastSync': !exists(json, 'lastSync') ? undefined : (json['lastSync'] === null ? null : new Date(json['lastSync'])),
91
97
  'syncStatus': !exists(json, 'syncStatus') ? undefined : SyncStatusFromJSON(json['syncStatus']),
92
98
  'commitHash': !exists(json, 'commitHash') ? undefined : json['commitHash'],
99
+ 'isAuthorized': !exists(json, 'isAuthorized') ? undefined : json['isAuthorized'],
93
100
  };
94
101
  }
95
102
 
@@ -108,6 +115,7 @@ export function CustomPipelineSettingsToJSON(value?: CustomPipelineSettings | nu
108
115
  'lastSync': value.lastSync === undefined ? undefined : (value.lastSync === null ? null : value.lastSync.toISOString()),
109
116
  'syncStatus': SyncStatusToJSON(value.syncStatus),
110
117
  'commitHash': value.commitHash,
118
+ 'isAuthorized': value.isAuthorized,
111
119
  };
112
120
  }
113
121