diff --git a/__tests__/services/zendesk-api-service.spec.ts b/__tests__/services/zendesk-api-service.spec.ts index 357ef3b..5193dc1 100644 --- a/__tests__/services/zendesk-api-service.spec.ts +++ b/__tests__/services/zendesk-api-service.spec.ts @@ -757,4 +757,20 @@ describe("ZendeskService", () => { expect(requestMock).toHaveBeenCalledTimes(1); }); }); + + describe("uploadZisBundle", () => { + it("should upload a Zis bundle with the correct data", async () => { + await service.uploadZisBundle("integrationName", { + name: "zis:bundle" + }); + + expect(requestMock).toHaveBeenNthCalledWith(1, { + url: `/api/services/zis/registry/integrationName/bundles`, + method: "POST", + contentType: "application/json", + data: JSON.stringify({ name: "zis:bundle" }) + }); + expect(requestMock).toHaveBeenCalledTimes(1); + }); + }); }); diff --git a/package.json b/package.json index df5ca7b..19a6a1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zendesk/zaf-toolbox", - "version": "0.8.0", + "version": "0.9.0", "description": "A toolbox for ZAF application built with 🩷 by Zendesk Labs", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", diff --git a/src/services/zendesk-api-service.ts b/src/services/zendesk-api-service.ts index 840fd74..f8d63cd 100644 --- a/src/services/zendesk-api-service.ts +++ b/src/services/zendesk-api-service.ts @@ -481,4 +481,19 @@ export class ZendeskApiService { }) }); } + + /** + * Fetches the ZIS integration by name. + * + * @param {string} integrationName - The name of the ZIS integration. + * @returns {Promise} - The ZIS integration object. + **/ + public async uploadZisBundle(integrationName: string, bundle: unknown): Promise { + return await this.client.request({ + url: `/api/services/zis/registry/${integrationName}/bundles`, + method: "POST", + contentType: "application/json", + data: JSON.stringify(bundle) + }); + } }