Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated packages #54

Merged
merged 9 commits into from
Oct 18, 2023
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [2.0.0] - 2023-10-18
### Added
- Use `axios` to send HTTP requests

### Changed
- Removed dependencies on `http`, `bluebird`, `request`
- Use customgrouping3 instead of customgrouping for categorization
- Target `ES2022` instead of `ES5`
- Various package versions

### Removed
- Possibility to use a query string
- Deprecated methods from `MessageApiClient.ts`

## [1.4.1] - 2022-12-12
### Changed
- Update model for WhatsApp Interactive.
Expand Down
20 changes: 3 additions & 17 deletions lib/MessageApiClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CMTypes from "../typescript-node-client/api";
import http = require('http');
import axios = require('axios');

export type Channel = "SMS" | "Viber" | "RCS" | "Apple Messages for Business" | "WhatsApp" | "Telegram Messenger" | "Twitter" | "MobilePush" | "Facebook Messenger" | "Google Business Messages" | "Instagram";
export type RichMessage = CMTypes.RichMessage;
Expand Down Expand Up @@ -29,20 +29,6 @@ export class MessageApiClient {
return new Message(this.productToken);
}

/**
* @deprecated use .sendTextMessages(...) instead
*/
public SendTextMessage(to: string, from: string, message: string, reference: string = undefined) {
return this.SendTextMessages([to], from, message, reference);
}

/**
* @deprecated use .sendTextMessages(...) instead
*/
public SendTextMessages(to: string[], from: string, message: string, reference: string = undefined) {
return this.sendTextMessage(to, from, message, reference);
}

/**
* Send an SMS message
* @param to array of recipients for the message, specify the numbers in international format with leading 00
Expand Down Expand Up @@ -90,7 +76,7 @@ export class Message extends CMTypes.MessageEnvelope {
*/
public setMessage(to: string[], from: string, message: string, reference: string = undefined): Message {
const msg = new CMTypes.Message();
msg.customGrouping = "text-sdk-javascript";
msg.customGrouping3 = "text-sdk-javascript";
msg.from = from;
msg.body = new CMTypes.MessageBody();
msg.body.type = "AUTO";
Expand Down Expand Up @@ -154,7 +140,7 @@ export class Message extends CMTypes.MessageEnvelope {
/**
* Sends the message to the CM.com Platform
*/
public send(): Promise<{ body: MessagesResponse; response: http.IncomingMessage }> {
public send(): Promise<axios.AxiosResponse<any, any>> {
return this.api.messagesSendMessage(this);
}

Expand Down
Loading
Loading