Skip to content

Commit 6ee4b27

Browse files
committed
chore(sunshine-conversation): update type for notification response
1 parent 0b5d482 commit 6ee4b27

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

__tests__/services/sunshine-conversation-api-service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ describe("SunshineConversationApiService", () => {
296296
};
297297

298298
const response: IResponse<IMessageTemplate> = {
299-
responseJson: {
299+
responseJSON: {
300300
...payload,
301301
messageTemplate: { status: TemplateStatus.APPROVED, id: "id" }
302302
}
@@ -321,7 +321,7 @@ describe("SunshineConversationApiService", () => {
321321
);
322322

323323
expect(client.request).toHaveBeenCalledWith(options);
324-
expect(template).toBe(response.responseJson);
324+
expect(template).toBe(response.responseJSON);
325325
});
326326
});
327327

src/models/sunshine-conversation.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,8 @@ export interface ISendNotificationPayload {
417417
metadata?: IMetadata;
418418
}
419419

420-
export interface ISendNotificationResponse {
421-
responseJSON: {
422-
notification: { _id: string };
423-
};
420+
export interface ISendNotification {
421+
notification: { _id: string };
424422
}
425423

426424
// ====

src/models/whats-app-template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export interface ITemplatesResponse {
145145
}
146146

147147
export interface IResponse<T> {
148-
responseJson: T;
148+
responseJSON: T;
149149
}
150150

151151
export interface IMessageTemplate extends ICreateTemplate {

src/services/sunshine-conversation-api-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {
1515
ISunshineConversationPageParameters,
1616
ISunshineConversationGetIntegrationsFilters,
1717
IMetadata,
18-
ISendNotificationResponse,
19-
IMessageTemplate
18+
IMessageTemplate,
19+
ISendNotification
2020
} from "@models/index";
2121
import { buildUrlParams } from "@utils/build-url-params";
2222
import { INTERNATIONAL_PHONE_NUMBER_REGEX } from "@utils/regex";
@@ -183,7 +183,7 @@ export class SunshineConversationApiService {
183183
HttpMethod.POST,
184184
createTemplateBody
185185
);
186-
return (await this.client.request<unknown, IResponse<IMessageTemplate>>(options)).responseJson;
186+
return (await this.client.request<unknown, IResponse<IMessageTemplate>>(options)).responseJSON;
187187
}
188188

189189
/**
@@ -235,7 +235,7 @@ export class SunshineConversationApiService {
235235
...(metadata && { metadata })
236236
};
237237

238-
const { responseJSON } = await this.client.request<unknown, ISendNotificationResponse>(
238+
const { responseJSON } = await this.client.request<unknown, IResponse<ISendNotification>>(
239239
this.createV1Options(`/apps/${this.settings.appId}/notifications`, HttpMethod.POST, payload)
240240
);
241241

0 commit comments

Comments
 (0)