@@ -25,7 +25,10 @@ else {
2525 FormData = undici . FormData ;
2626}
2727
28+ import { CreateCustomBlockUploadLinkRequest } from '../model/createCustomBlockUploadLinkRequest' ;
29+ import { CreateCustomBlockUploadLinkResponse } from '../model/createCustomBlockUploadLinkResponse' ;
2830import { CreateProjectResponse } from '../model/createProjectResponse' ;
31+ import { FinalizeCustomBlockUploadRequest } from '../model/finalizeCustomBlockUploadRequest' ;
2932import { GenericApiResponse } from '../model/genericApiResponse' ;
3033import { OrganizationCreateProjectRequest } from '../model/organizationCreateProjectRequest' ;
3134import { OrganizationCreateProjectResponse } from '../model/organizationCreateProjectResponse' ;
@@ -243,6 +246,95 @@ export class OrganizationCreateProjectApi {
243246 ) ;
244247 }
245248
249+ /**
250+ * Creates a signed link to securely upload a custom block archive directly to S3.
251+ * @summary Create pre-signed S3 upload link for a custom block archive
252+ * @param organizationId Organization ID
253+ * @param createCustomBlockUploadLinkRequest
254+ */
255+ public async createCustomBlockUploadLink ( organizationId : number , createCustomBlockUploadLinkRequest : CreateCustomBlockUploadLinkRequest , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < CreateCustomBlockUploadLinkResponse > {
256+ const localVarPath = this . basePath + '/api/organizations/{organizationId}/custom-block/upload-link'
257+ . replace ( '{' + 'organizationId' + '}' , encodeURIComponent ( String ( organizationId ) ) ) ;
258+ let queryParameters : Record < string , string > = { } ;
259+ let localVarHeaderParams : Record < string , string > = {
260+ 'User-Agent' : 'edgeimpulse-api nodejs' ,
261+ 'Content-Type' : 'application/json' ,
262+ ...this . defaultHeaders ,
263+ } ;
264+ const produces = [ 'application/json' ] ;
265+ // give precedence to 'application/json'
266+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
267+ localVarHeaderParams . Accept = 'application/json' ;
268+ } else {
269+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
270+ }
271+ let localVarFormParams : LocalFormParams | undefined ;
272+
273+ // verify required parameter 'organizationId' is not null or undefined
274+
275+
276+ if ( organizationId === null || organizationId === undefined ) {
277+ throw new Error ( 'Required parameter organizationId was null or undefined when calling createCustomBlockUploadLink.' ) ;
278+ }
279+
280+ // verify required parameter 'createCustomBlockUploadLinkRequest' is not null or undefined
281+
282+
283+ if ( createCustomBlockUploadLinkRequest === null || createCustomBlockUploadLinkRequest === undefined ) {
284+ throw new Error ( 'Required parameter createCustomBlockUploadLinkRequest was null or undefined when calling createCustomBlockUploadLink.' ) ;
285+ }
286+
287+ localVarHeaderParams = {
288+ ...localVarHeaderParams ,
289+ ...options . headers ,
290+ ...this . opts . extraHeaders ,
291+ } ;
292+
293+ const queryString = Object . entries ( queryParameters )
294+ . filter ( ( [ , value ] ) => value !== undefined )
295+ . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( String ( value ) ) } ` )
296+ . join ( '&' ) ;
297+
298+ let localVarUrl = localVarPath + ( queryString ? `?${ queryString } ` : '' ) ;
299+ let localVarRequestOptions : RequestOptionsType = {
300+ method : 'POST' ,
301+ headers : { ...localVarHeaderParams } ,
302+ } ;
303+
304+ localVarRequestOptions . body = JSON . stringify ( createCustomBlockUploadLinkRequest ) ;
305+
306+
307+ let requestOptions = localVarRequestOptions ;
308+ let url = localVarUrl ;
309+ const auth_ApiKeyAuthentication = await this . authentications . ApiKeyAuthentication . applyToRequest ( requestOptions , url ) ;
310+ requestOptions = auth_ApiKeyAuthentication . requestOptions ;
311+ url = auth_ApiKeyAuthentication . url ;
312+
313+ const auth_JWTAuthentication = await this . authentications . JWTAuthentication . applyToRequest ( requestOptions , url ) ;
314+ requestOptions = auth_JWTAuthentication . requestOptions ;
315+ url = auth_JWTAuthentication . url ;
316+
317+ const auth_JWTHttpHeaderAuthentication = await this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( requestOptions , url ) ;
318+ requestOptions = auth_JWTHttpHeaderAuthentication . requestOptions ;
319+ url = auth_JWTHttpHeaderAuthentication . url ;
320+
321+ const auth_OAuth2 = await this . authentications . OAuth2 . applyToRequest ( requestOptions , url ) ;
322+ requestOptions = auth_OAuth2 . requestOptions ;
323+ url = auth_OAuth2 . url ;
324+
325+ const authDefault = await this . authentications . default . applyToRequest ( requestOptions , url ) ;
326+ requestOptions = authDefault . requestOptions ;
327+ url = authDefault . url ;
328+
329+ applyFormParams ( requestOptions , localVarFormParams ) ;
330+
331+ const response = await fetch ( url , requestOptions ) ;
332+ return this . handleResponse (
333+ response ,
334+ 'CreateCustomBlockUploadLinkResponse'
335+ ) ;
336+ }
337+
246338 /**
247339 * Remove a transformation job. This will stop all running jobs.
248340 * @summary Delete transformation job
@@ -428,6 +520,95 @@ export class OrganizationCreateProjectApi {
428520 ) ;
429521 }
430522
523+ /**
524+ * Verifies a staged custom block archive and starts a custom block build job.
525+ * @summary Finalize custom block upload
526+ * @param organizationId Organization ID
527+ * @param finalizeCustomBlockUploadRequest
528+ */
529+ public async finalizeCustomBlockUpload ( organizationId : number , finalizeCustomBlockUploadRequest : FinalizeCustomBlockUploadRequest , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < StartJobResponse > {
530+ const localVarPath = this . basePath + '/api/organizations/{organizationId}/custom-block/finalize'
531+ . replace ( '{' + 'organizationId' + '}' , encodeURIComponent ( String ( organizationId ) ) ) ;
532+ let queryParameters : Record < string , string > = { } ;
533+ let localVarHeaderParams : Record < string , string > = {
534+ 'User-Agent' : 'edgeimpulse-api nodejs' ,
535+ 'Content-Type' : 'application/json' ,
536+ ...this . defaultHeaders ,
537+ } ;
538+ const produces = [ 'application/json' ] ;
539+ // give precedence to 'application/json'
540+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
541+ localVarHeaderParams . Accept = 'application/json' ;
542+ } else {
543+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
544+ }
545+ let localVarFormParams : LocalFormParams | undefined ;
546+
547+ // verify required parameter 'organizationId' is not null or undefined
548+
549+
550+ if ( organizationId === null || organizationId === undefined ) {
551+ throw new Error ( 'Required parameter organizationId was null or undefined when calling finalizeCustomBlockUpload.' ) ;
552+ }
553+
554+ // verify required parameter 'finalizeCustomBlockUploadRequest' is not null or undefined
555+
556+
557+ if ( finalizeCustomBlockUploadRequest === null || finalizeCustomBlockUploadRequest === undefined ) {
558+ throw new Error ( 'Required parameter finalizeCustomBlockUploadRequest was null or undefined when calling finalizeCustomBlockUpload.' ) ;
559+ }
560+
561+ localVarHeaderParams = {
562+ ...localVarHeaderParams ,
563+ ...options . headers ,
564+ ...this . opts . extraHeaders ,
565+ } ;
566+
567+ const queryString = Object . entries ( queryParameters )
568+ . filter ( ( [ , value ] ) => value !== undefined )
569+ . map ( ( [ key , value ] ) => `${ key } =${ encodeURIComponent ( String ( value ) ) } ` )
570+ . join ( '&' ) ;
571+
572+ let localVarUrl = localVarPath + ( queryString ? `?${ queryString } ` : '' ) ;
573+ let localVarRequestOptions : RequestOptionsType = {
574+ method : 'POST' ,
575+ headers : { ...localVarHeaderParams } ,
576+ } ;
577+
578+ localVarRequestOptions . body = JSON . stringify ( finalizeCustomBlockUploadRequest ) ;
579+
580+
581+ let requestOptions = localVarRequestOptions ;
582+ let url = localVarUrl ;
583+ const auth_ApiKeyAuthentication = await this . authentications . ApiKeyAuthentication . applyToRequest ( requestOptions , url ) ;
584+ requestOptions = auth_ApiKeyAuthentication . requestOptions ;
585+ url = auth_ApiKeyAuthentication . url ;
586+
587+ const auth_JWTAuthentication = await this . authentications . JWTAuthentication . applyToRequest ( requestOptions , url ) ;
588+ requestOptions = auth_JWTAuthentication . requestOptions ;
589+ url = auth_JWTAuthentication . url ;
590+
591+ const auth_JWTHttpHeaderAuthentication = await this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( requestOptions , url ) ;
592+ requestOptions = auth_JWTHttpHeaderAuthentication . requestOptions ;
593+ url = auth_JWTHttpHeaderAuthentication . url ;
594+
595+ const auth_OAuth2 = await this . authentications . OAuth2 . applyToRequest ( requestOptions , url ) ;
596+ requestOptions = auth_OAuth2 . requestOptions ;
597+ url = auth_OAuth2 . url ;
598+
599+ const authDefault = await this . authentications . default . applyToRequest ( requestOptions , url ) ;
600+ requestOptions = authDefault . requestOptions ;
601+ url = authDefault . url ;
602+
603+ applyFormParams ( requestOptions , localVarFormParams ) ;
604+
605+ const response = await fetch ( url , requestOptions ) ;
606+ return this . handleResponse (
607+ response ,
608+ 'StartJobResponse'
609+ ) ;
610+ }
611+
431612 /**
432613 * Get the current status of a transformation job job.
433614 * @summary Get transformation job status
0 commit comments