Skip to content

Commit

Permalink
Merge pull request #115 from green-api/SW-2643
Browse files Browse the repository at this point in the history
Sw 2643
  • Loading branch information
Amele9 authored Mar 7, 2024
2 parents 30bf83e + c31405e commit 5071ea6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/utils/GroupAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ class GroupAPI {
* @param {String} participantChatId
* @param {Number} participantPhone
*/
async setGroupAdmin(groupId, participantChatId, participantPhone) {
async setGroupAdmin(groupId, participantChatId, participantPhone = null) {
CommonUtils.validateString('groupId', groupId);

const method = 'setGroupAdmin';
const postData = {
'groupId': groupId,
'participantChatId': participantChatId,
'participantPhone': participantPhone,
}
const response = await axios.post(CommonUtils.generateMethodURL(this._restAPI.params, method), postData);
return response.data;
Expand All @@ -125,14 +124,13 @@ class GroupAPI {
* @param {String} participantChatId
* @param {Number} participantPhone
*/
async removeAdmin(groupId, participantChatId, participantPhone) {
async removeAdmin(groupId, participantChatId, participantPhone = null) {
CommonUtils.validateString('groupId', groupId);

const method = 'removeAdmin';
const postData = {
'groupId': groupId,
'participantChatId': participantChatId,
'participantPhone': participantPhone,
}
const response = await axios.post(CommonUtils.generateMethodURL(this._restAPI.params, method), postData);
return response.data;
Expand All @@ -145,7 +143,7 @@ class GroupAPI {
async leaveGroup(groupId) {
CommonUtils.validateString('groupId', groupId);

const method = 'removeAdmin';
const method = 'leaveGroup';
const postData = {
'groupId': groupId,
}
Expand Down
15 changes: 15 additions & 0 deletions src/utils/InstanceAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ class InstanceAPI {
return response.data
}

/**
*
* @param {Number} phoneNumber
*/
async getAuthorizationCode(phoneNumber) {
CommonUtils.validateInteger('phoneNumber', phoneNumber);

const method = 'getAuthorizationCode';
const postData = {
'phoneNumber': phoneNumber,
}
const response = await axios.post(CommonUtils.generateMethodURL(this._restAPI.params, method), postData);
return response.data
}

/**
*
* @param {String} chatId
Expand Down

0 comments on commit 5071ea6

Please sign in to comment.