Skip to content

Commit

Permalink
Merge pull request #154 from onfido/release-upgrade
Browse files Browse the repository at this point in the history
Refresh onfido-node after onfido-openapi-spec update (54ce45f)
  • Loading branch information
miguelfteixeira authored Jan 8, 2025
2 parents 3fa01cf + 0e4015e commit a5e33a3
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .release.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"source": {
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
"short_sha": "964fb43",
"long_sha": "964fb43a1bf211197ef7a45c230771b8ba561b3c",
"version": "v4.4.0"
"short_sha": "54ce45f",
"long_sha": "54ce45f2138f044cc5cb40f6904dc7bc1a675be6",
"version": "v4.5.0"
},
"release": "v4.4.0"
"release": "v4.5.0"
}
72 changes: 72 additions & 0 deletions api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11389,6 +11389,43 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Retrieves the evidence folder for the designated Workflow Run
* @summary Retrieve Workflow Run Evidence Folder
* @param {string} workflowRunId Workflow Run ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
downloadEvidenceFolder: async (workflowRunId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'workflowRunId' is not null or undefined
assertParamExists('downloadEvidenceFolder', 'workflowRunId', workflowRunId)
const localVarPath = `/workflow_runs/{workflow_run_id}/evidence_folder`
.replace(`{${"workflow_run_id"}}`, encodeURIComponent(String(workflowRunId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

// authentication Token required
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
Expand Down Expand Up @@ -13654,6 +13691,19 @@ export const DefaultApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['DefaultApi.downloadDocumentVideo']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Retrieves the evidence folder for the designated Workflow Run
* @summary Retrieve Workflow Run Evidence Folder
* @param {string} workflowRunId Workflow Run ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async downloadEvidenceFolder(workflowRunId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FileTransfer>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.downloadEvidenceFolder(workflowRunId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DefaultApi.downloadEvidenceFolder']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* ID photos are downloaded using this endpoint.
* @summary Download ID photo
Expand Down Expand Up @@ -14490,6 +14540,16 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
downloadDocumentVideo(documentId: string, options?: RawAxiosRequestConfig): AxiosPromise<FileTransfer> {
return localVarFp.downloadDocumentVideo(documentId, options).then((request) => request(axios, basePath));
},
/**
* Retrieves the evidence folder for the designated Workflow Run
* @summary Retrieve Workflow Run Evidence Folder
* @param {string} workflowRunId Workflow Run ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
downloadEvidenceFolder(workflowRunId: string, options?: RawAxiosRequestConfig): AxiosPromise<FileTransfer> {
return localVarFp.downloadEvidenceFolder(workflowRunId, options).then((request) => request(axios, basePath));
},
/**
* ID photos are downloaded using this endpoint.
* @summary Download ID photo
Expand Down Expand Up @@ -15201,6 +15261,18 @@ export class DefaultApi extends BaseAPI {
return DefaultApiFp(this.configuration).downloadDocumentVideo(documentId, options).then((request) => request(this.axios, this.basePath));
}

/**
* Retrieves the evidence folder for the designated Workflow Run
* @summary Retrieve Workflow Run Evidence Folder
* @param {string} workflowRunId Workflow Run ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public downloadEvidenceFolder(workflowRunId: string, options?: RawAxiosRequestConfig) {
return DefaultApiFp(this.configuration).downloadEvidenceFolder(workflowRunId, options).then((request) => request(this.axios, this.basePath));
}

/**
* ID photos are downloaded using this endpoint.
* @summary Download ID photo
Expand Down
2 changes: 1 addition & 1 deletion configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Configuration {
this.baseOptions = {...{ timeout: 30_000 },
...param.baseOptions,
...{ headers: {...param.baseOptions?.headers,
...{'User-Agent': 'onfido-node/4.4.0'}}}};
...{'User-Agent': 'onfido-node/4.5.0'}}}};
this.formDataCtor = param.formDataCtor || require('form-data'); // Injiect form data constructor (if needed)
}

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onfido/api",
"version": "4.4.0",
"version": "4.5.0",
"description": "Node.js library for the Onfido API",
"author": "OpenAPI-Generator Contributors",
"repository": {
Expand Down
17 changes: 17 additions & 0 deletions test/resources/workflow-runs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,20 @@ it("downloads a timeline file", async () => {
expect(file.headers["content-type"]).toEqual("application/pdf");
expect(file.data.buffer.slice(0, 5)).toEqual("%PDF-");
}, 60000);

it("downloads an evidence folder", async () => {
const workflowRunId = (await createWorkflowRun(applicant, workflowIdTimeline))
.data.id;

await repeatRequestUntilStatusChanges(
"findWorkflowRun",
[workflowRunId],
"approved"
);

const file = await onfido.downloadEvidenceFolder(workflowRunId);

expect(file.status).toEqual(200);
expect(file.headers["content-type"]).toEqual("application/zip");
expect(file.data.buffer.length).toBeGreaterThan(0);
}, 60000);

0 comments on commit a5e33a3

Please sign in to comment.