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

Sw 2643 #115

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions src/utils/GroupAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,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 @@ -126,14 +125,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 @@ -146,7 +144,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
Loading