Skip to content

Commit

Permalink
Merge pull request #54 from cmdotcom/feature/remove-deprecated-packages
Browse files Browse the repository at this point in the history
Remove deprecated packages
  • Loading branch information
SoufyanBreda2 authored Oct 18, 2023
2 parents 5713433 + 61263c9 commit da9a878
Show file tree
Hide file tree
Showing 7 changed files with 448 additions and 1,131 deletions.
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

0 comments on commit da9a878

Please sign in to comment.