quria
Version:
A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.
456 lines (451 loc) • 26.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupV2 = void 0;
const adapters_1 = require("../../adapters");
class GroupV2 {
url;
headers;
constructor(url, headers) {
this.url = url;
this.headers = headers;
}
/**
* Returns a list of all available group avatars for the signed-in user.
* @returns Returns a list of all available group avatars for the signed-in user.
*/
GetAvailableAvatars(tokens) {
const requestURL = `${this.url}/GroupV2/GetAvailableAvatars/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns a list of all available group themes.
* @returns Returns a list of all available group themes.
*/
GetAvailableThemes(tokens) {
const requestURL = `${this.url}/GroupV2/GetAvailableThemes/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets the state of the user's clan invite preferences for a particular membership type - true if they wish to be invited to clans, false otherwise.
* @param mType The Destiny membership type of the account we wish to access settings.
* @returns Gets the state of the user's clan invite preferences for a particular membership type - true if they wish to be invited to clans, false otherwise.
*/
GetUserClanInviteSetting(mType, tokens) {
const requestURL = `${this.url}/GroupV2/GetUserClanInviteSetting/${mType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets groups recommended for you based on the groups to whom those you follow belong.
* @param createDateRange Requested range in which to pull recommended groups
* @param groupType Type of groups requested
* @returns Gets groups recommended for you based on the groups to whom those you follow belong.
*/
GetRecommendedGroups(createDateRange, groupType, tokens) {
const requestURL = `${this.url}/GroupV2/Recommended/${groupType}/${createDateRange}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
/**
* Search for Groups.
* @returns Search for Groups.
*/
GroupSearch(name, groupType, creationDate, sortBy, groupMemberCountFilter, localeFilter, tagText, itemsPerPage, currentPage, requestContinuationToken, tokens) {
const requestURL = `${this.url}/GroupV2/Search/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
name,
groupType,
creationDate,
sortBy,
groupMemberCountFilter,
localeFilter,
tagText,
itemsPerPage,
currentPage,
requestContinuationToken,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Get information about a specific group of the given ID.
* @param groupId Requested group's id.
* @returns Get information about a specific group of the given ID.
*/
GetGroup(groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get information about a specific group with the given name and type.
* @param groupName Exact name of the group to find.
* @param groupType Type of group to find.
* @returns Get information about a specific group with the given name and type.
*/
GetGroupByName(groupName, groupType, tokens) {
const requestURL = `${this.url}/GroupV2/Name/${groupName}/${groupType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get information about a specific group with the given name and type. The POST version.
* @returns Get information about a specific group with the given name and type. The POST version.
*/
GetGroupByNameV2(groupName, groupType, tokens) {
const requestURL = `${this.url}/GroupV2/NameV2/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { groupName, groupType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Gets a list of available optional conversation channels and their settings.
* @param groupId Requested group's id.
* @returns Gets a list of available optional conversation channels and their settings.
*/
GetGroupOptionalConversations(groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/OptionalConversations/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.
* @param groupId Group ID of the group to edit.
* @returns Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.
*/
EditGroup(groupId, name, about, motto, theme, avatarImageIndex, tags, isPublic, membershipOption, isPublicTopicAdminOnly, allowChat, chatSecurity, callsign, locale, homepage, enableInvitationMessagingForAdmins, defaultPublicity, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Edit/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
name,
about,
motto,
theme,
avatarImageIndex,
tags,
isPublic,
membershipOption,
isPublicTopicAdminOnly,
allowChat,
chatSecurity,
callsign,
locale,
homepage,
enableInvitationMessagingForAdmins,
defaultPublicity,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.
* @param groupId Group ID of the group to edit.
* @returns Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.
*/
EditClanBanner(groupId, decalId, decalColorId, decalBackgroundColorId, gonfalonId, gonfalonColorId, gonfalonDetailId, gonfalonDetailColorId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/EditClanBanner/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
decalId,
decalColorId,
decalBackgroundColorId,
gonfalonId,
gonfalonColorId,
gonfalonDetailId,
gonfalonDetailColorId,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.
* @param groupId Group ID of the group to edit.
* @returns Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.
*/
EditFounderOptions(groupId, InvitePermissionOverride, UpdateCulturePermissionOverride, HostGuidedGamePermissionOverride, UpdateBannerPermissionOverride, JoinLevel, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/EditFounderOptions/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
InvitePermissionOverride,
UpdateCulturePermissionOverride,
HostGuidedGamePermissionOverride,
UpdateBannerPermissionOverride,
JoinLevel,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Add a new optional conversation/chat channel. Requires admin permissions to the group.
* @param groupId Group ID of the group to edit.
* @returns Add a new optional conversation/chat channel. Requires admin permissions to the group.
*/
AddOptionalConversation(groupId, chatName, chatSecurity, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/OptionalConversations/Add/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { chatName, chatSecurity };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.
* @param conversationId Conversation Id of the channel being edited.
* @param groupId Group ID of the group to edit.
* @returns Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.
*/
EditOptionalConversation(conversationId, groupId, chatEnabled, chatName, chatSecurity, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/OptionalConversations/Edit/${conversationId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { chatEnabled, chatName, chatSecurity };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Get the list of members in a given group.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 items per page.
* @param groupId The ID of the group.
* @param memberType Filter out other member types. Use None for all members.
* @param nameSearch The name fragment upon which a search should be executed for members with matching display or unique names.
* @returns Get the list of members in a given group.
*/
GetMembersOfGroup(currentpage, groupId, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/GroupV2/${groupId}/Members/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get the list of members in a given group who are of admin level or higher.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 items per page.
* @param groupId The ID of the group.
* @returns Get the list of members in a given group who are of admin level or higher.
*/
GetAdminsAndFounderOfGroup(currentpage, groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/AdminsAndFounder/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.
* @param groupId ID of the group to which the member belongs.
* @param membershipId Membership ID to modify.
* @param membershipType Membership type of the provide membership ID.
* @param memberType New membertype for the specified member.
* @returns Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.
*/
EditGroupMembership(groupId, membershipId, membershipType, memberType, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/${membershipType}/${membershipId}/SetMembershipType/${memberType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
/**
* Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.
* @param groupId Group ID to kick the user from.
* @param membershipId Membership ID to kick.
* @param membershipType Membership type of the provided membership ID.
* @returns Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.
*/
KickMember(groupId, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/${membershipType}/${membershipId}/Kick/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
/**
* Bans the requested member from the requested group for the specified period of time.
* @param groupId Group ID that has the member to ban.
* @param membershipId Membership ID of the member to ban from the group.
* @param membershipType Membership type of the provided membership ID.
* @returns Bans the requested member from the requested group for the specified period of time.
*/
BanMember(groupId, membershipId, membershipType, comment, length, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/${membershipType}/${membershipId}/Ban/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { comment, length };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Unbans the requested member, allowing them to re-apply for membership.
* @param groupId
* @param membershipId Membership ID of the member to unban from the group
* @param membershipType Membership type of the provided membership ID.
* @returns Unbans the requested member, allowing them to re-apply for membership.
*/
UnbanMember(groupId, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/${membershipType}/${membershipId}/Unban/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
/**
* Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 entries.
* @param groupId Group ID whose banned members you are fetching
* @returns Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.
*/
GetBannedMembersOfGroup(currentpage, groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Banned/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get the list of edits made to a given group. Only accessible to group Admins and above.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 entries.
* @param groupId Group ID whose edit history you are fetching
* @returns Get the list of edits made to a given group. Only accessible to group Admins and above.
*/
GetGroupEditHistory(currentpage, groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/EditHistory/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.
* @param founderIdNew The new founder for this group. Must already be a group admin.
* @param groupId The target group id.
* @param membershipType Membership type of the provided founderIdNew.
* @returns An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.
*/
AbdicateFoundership(founderIdNew, groupId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Admin/AbdicateFoundership/${membershipType}/${founderIdNew}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
/**
* Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 items per page.
* @param groupId ID of the group.
* @returns Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.
*/
GetPendingMemberships(currentpage, groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/Pending/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get the list of users who have been invited into the group.
* @param currentpage Page number (starting with 1). Each page has a fixed size of 50 items per page.
* @param groupId ID of the group.
* @returns Get the list of users who have been invited into the group.
*/
GetInvitedIndividuals(currentpage, groupId, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/InvitedIndividuals/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Approve all of the pending users for the given group.
* @param groupId ID of the group.
* @returns Approve all of the pending users for the given group.
*/
ApproveAllPending(groupId, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/ApproveAll/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Deny all of the pending users for the given group.
* @param groupId ID of the group.
* @returns Deny all of the pending users for the given group.
*/
DenyAllPending(groupId, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/DenyAll/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Approve all of the pending users for the given group.
* @param groupId ID of the group.
* @returns Approve all of the pending users for the given group.
*/
ApprovePendingForList(groupId, memberships, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/ApproveList/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { memberships, message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Approve the given membershipId to join the group/clan as long as they have applied.
* @param groupId ID of the group.
* @param membershipId The membership id being approved.
* @param membershipType Membership type of the supplied membership ID.
* @returns Approve the given membershipId to join the group/clan as long as they have applied.
*/
ApprovePending(groupId, membershipId, membershipType, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/Approve/${membershipType}/${membershipId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Deny all of the pending users for the given group that match the passed-in .
* @param groupId ID of the group.
* @returns Deny all of the pending users for the given group that match the passed-in .
*/
DenyPendingForList(groupId, memberships, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/DenyList/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { memberships, message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Get information about the groups that a given member has joined.
* @param filter Filter apply to list of joined groups.
* @param groupType Type of group the supplied member founded.
* @param membershipId Membership ID to for which to find founded groups.
* @param membershipType Membership type of the supplied membership ID.
* @returns Get information about the groups that a given member has joined.
*/
GetGroupsForMember(filter, groupType, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/User/${membershipType}/${membershipId}/${filter}/${groupType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Allows a founder to manually recover a group they can see in game but not on bungie.net
* @param groupType Type of group the supplied member founded.
* @param membershipId Membership ID to for which to find founded groups.
* @param membershipType Membership type of the supplied membership ID.
* @returns Allows a founder to manually recover a group they can see in game but not on bungie.net
*/
RecoverGroupForFounder(groupType, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/Recover/${membershipType}/${membershipId}/${groupType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get information about the groups that a given member has applied to or been invited to.
* @param filter Filter apply to list of potential joined groups.
* @param groupType Type of group the supplied member applied.
* @param membershipId Membership ID to for which to find applied groups.
* @param membershipType Membership type of the supplied membership ID.
* @returns Get information about the groups that a given member has applied to or been invited to.
*/
GetPotentialGroupsForMember(filter, groupType, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/User/Potential/${membershipType}/${membershipId}/${filter}/${groupType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Invite a user to join this group.
* @param groupId ID of the group you would like to join.
* @param membershipId Membership id of the account being invited.
* @param membershipType MembershipType of the account being invited.
* @returns Invite a user to join this group.
*/
IndividualGroupInvite(groupId, membershipId, membershipType, message, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/IndividualInvite/${membershipType}/${membershipId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { message };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Cancels a pending invitation to join a group.
* @param groupId ID of the group you would like to join.
* @param membershipId Membership id of the account being cancelled.
* @param membershipType MembershipType of the account being cancelled.
* @returns Cancels a pending invitation to join a group.
*/
IndividualGroupInviteCancel(groupId, membershipId, membershipType, tokens) {
const requestURL = `${this.url}/GroupV2/${groupId}/Members/IndividualInviteCancel/${membershipType}/${membershipId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders);
}
}
exports.GroupV2 = GroupV2;