Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/models/bandwidthMessageItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
*/

import { number, object, optional, Schema, string } from '../schema';
import { number, object, optional, Schema, string, nullable } from '../schema';

export interface BandwidthMessageItem {
/** The message id */
Expand All @@ -28,7 +28,7 @@ export interface BandwidthMessageItem {
/** The ISO 8601 datetime of the message */
receiveTime?: string;
/** The name of the carrier. Not currently supported for MMS, coming soon */
carrierName?: string;
carrierName?: string | null;
}

export const bandwidthMessageItemSchema: Schema<BandwidthMessageItem> = object({
Expand All @@ -42,5 +42,5 @@ export const bandwidthMessageItemSchema: Schema<BandwidthMessageItem> = object({
segmentCount: ['segmentCount', optional(number())],
errorCode: ['errorCode', optional(number())],
receiveTime: ['receiveTime', optional(string())],
carrierName: ['carrierName', optional(string())],
carrierName: ['carrierName', nullable(optional(string()))],
});
10 changes: 10 additions & 0 deletions tests/messaging.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ describe('messaging', () => {
expect(createMessageResponse.result.from).toEqual(fromPhoneNumber);
expect(createMessageResponse.result.text).toEqual(text);
});

it('should get messages', async () => {
const accountId = process.env.BW_ACCOUNT_ID;
const phoneNumber = process.env.BW_NUMBER;

const listMessagesResponse = await controller.getMessages(accountId, undefined, phoneNumber);
expect(listMessagesResponse.result.messages[0].messageId.length).toEqual(29);
expect(listMessagesResponse.result.messages[0].accountId).toEqual(accountId);
expect(listMessagesResponse.result.messages[0].sourceTn).toEqual(phoneNumber);
});


it('should throw an error on an invalid to number', async () => {
Expand Down