Skip to content

Commit 889bca3

Browse files
Release v1.25.0
1 parent 555ff32 commit 889bca3

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

sdk/studio/sdk/api/exportApi.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,89 @@ export class ExportApi {
145145
}
146146

147147

148+
/**
149+
* Download the data export. This\'ll redirect you to a signed S3 URL.
150+
* @summary Download export
151+
* @param projectId Project ID
152+
*/
153+
public async downloadExport (projectId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<any> {
154+
const localVarPath = this.basePath + '/api/{projectId}/export/download'
155+
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
156+
let localVarQueryParameters: Record<string, string> = {};
157+
let localVarHeaderParams: Record<string, string> = {
158+
'User-Agent': 'edgeimpulse-api nodejs',
159+
'Content-Type': 'application/json',
160+
...this.defaultHeaders,
161+
};
162+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
163+
164+
// verify required parameter 'projectId' is not null or undefined
165+
166+
167+
if (projectId === null || projectId === undefined) {
168+
throw new Error('Required parameter projectId was null or undefined when calling downloadExport.');
169+
}
170+
171+
localVarHeaderParams = {
172+
...localVarHeaderParams,
173+
...options.headers,
174+
...this.opts.extraHeaders,
175+
};
176+
177+
const queryString = Object.entries(localVarQueryParameters)
178+
.filter(([, value]) => value !== undefined)
179+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
180+
.join('&');
181+
182+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
183+
let localVarRequestOptions: RequestOptionsType = {
184+
method: 'GET',
185+
headers: { ...localVarHeaderParams },
186+
};
187+
188+
189+
let requestOptions = localVarRequestOptions;
190+
let url = localVarUrl;
191+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
192+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
193+
url = auth_ApiKeyAuthentication.url;
194+
195+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
196+
requestOptions = auth_JWTAuthentication.requestOptions;
197+
url = auth_JWTAuthentication.url;
198+
199+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
200+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
201+
url = auth_JWTHttpHeaderAuthentication.url;
202+
203+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
204+
requestOptions = auth_OAuth2.requestOptions;
205+
url = auth_OAuth2.url;
206+
207+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
208+
requestOptions = authDefault.requestOptions;
209+
url = authDefault.url;
210+
211+
if (localVarFormParams) {
212+
delete requestOptions.headers['Content-Type'];
213+
if (localVarFormParams instanceof FormData) {
214+
// FormData: fetch will handle Content-Type automatically.
215+
requestOptions.body = localVarFormParams;
216+
}
217+
else if (Object.keys(localVarFormParams).length > 0) {
218+
// URL-encoded form
219+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
220+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
221+
}
222+
}
223+
224+
const response = await fetch(url, requestOptions);
225+
return this.handleResponse(
226+
response,
227+
undefined
228+
);
229+
}
230+
148231
/**
149232
* Get the URL to the exported artefacts for an export job of a project.
150233
* @summary Get URL of export

0 commit comments

Comments
 (0)