quria
Version:
A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.
141 lines (139 loc) • 7.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Forum = void 0;
const adapters_1 = require("../../adapters");
class Forum {
url;
headers;
constructor(url, headers) {
this.url = url;
this.headers = headers;
}
/**
* Get topics from any forum.
* @param categoryFilter A category filter
* @param group The group, if any.
* @param locales Comma seperated list of locales posts must match to return in the result list. Default 'en'
* @param page Zero paged page number
* @param pageSize Unused
* @param quickDate A date filter.
* @param sort The sort mode.
* @param tagstring The tags to search, if any.
* @returns Get topics from any forum.
*/
GetTopicsPaged(categoryFilter, group, page, pageSize, quickDate, sort, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetTopicsPaged/${page}/${pageSize}/${group}/${sort}/${quickDate}/${categoryFilter}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets a listing of all topics marked as part of the core group.
* @param categoryFilter The category filter.
* @param locales Comma seperated list of locales posts must match to return in the result list. Default 'en'
* @param page Zero base page
* @param quickDate The date filter.
* @param sort The sort mode.
* @returns Gets a listing of all topics marked as part of the core group.
*/
GetCoreTopicsPaged(categoryFilter, page, quickDate, sort, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetCoreTopicsPaged/${page}/${sort}/${quickDate}/${categoryFilter}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns a thread of posts at the given parent, optionally returning replies to those posts as well as the original parent.
* @param getParentPost
* @param page
* @param pageSize
* @param parentPostId
* @param replySize
* @param rootThreadMode
* @param showbanned If this value is not null or empty, banned posts are requested to be returned
* @param sortMode
* @returns Returns a thread of posts at the given parent, optionally returning replies to those posts as well as the original parent.
*/
GetPostsThreadedPaged(getParentPost, page, pageSize, parentPostId, replySize, rootThreadMode, sortMode, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetPostsThreadedPaged/${parentPostId}/${page}/${pageSize}/${replySize}/${getParentPost}/${rootThreadMode}/${sortMode}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns a thread of posts starting at the topicId of the input childPostId, optionally returning replies to those posts as well as the original parent.
* @param childPostId
* @param page
* @param pageSize
* @param replySize
* @param rootThreadMode
* @param showbanned If this value is not null or empty, banned posts are requested to be returned
* @param sortMode
* @returns Returns a thread of posts starting at the topicId of the input childPostId, optionally returning replies to those posts as well as the original parent.
*/
GetPostsThreadedPagedFromChild(childPostId, page, pageSize, replySize, rootThreadMode, sortMode, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetPostsThreadedPagedFromChild/${childPostId}/${page}/${pageSize}/${replySize}/${rootThreadMode}/${sortMode}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns the post specified and its immediate parent.
* @param childPostId
* @param showbanned If this value is not null or empty, banned posts are requested to be returned
* @returns Returns the post specified and its immediate parent.
*/
GetPostAndParent(childPostId, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetPostAndParent/${childPostId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns the post specified and its immediate parent of posts that are awaiting approval.
* @param childPostId
* @param showbanned If this value is not null or empty, banned posts are requested to be returned
* @returns Returns the post specified and its immediate parent of posts that are awaiting approval.
*/
GetPostAndParentAwaitingApproval(childPostId, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetPostAndParentAwaitingApproval/${childPostId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets the post Id for the given content item's comments, if it exists.
* @param contentId
* @returns Gets the post Id for the given content item's comments, if it exists.
*/
GetTopicForContent(contentId, tokens) {
const requestURL = `${this.url}/Forum/GetTopicForContent/${contentId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets tag suggestions based on partial text entry, matching them with other tags previously used in the forums.
* @param partialtag The partial tag input to generate suggestions from.
* @returns Gets tag suggestions based on partial text entry, matching them with other tags previously used in the forums.
*/
GetForumTagSuggestions(queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Forum/GetForumTagSuggestions/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets the specified forum poll.
* @param topicId The post id of the topic that has the poll.
* @returns Gets the specified forum poll.
*/
GetPoll(topicId, tokens) {
const requestURL = `${this.url}/Forum/Poll/${topicId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Allows the caller to get a list of to 25 recruitment thread summary information objects.
* @returns Allows the caller to get a list of to 25 recruitment thread summary information objects.
*/
GetRecruitmentThreadSummaries(tokens) {
const requestURL = `${this.url}/Forum/Recruit/Summaries/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = [];
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
}
exports.Forum = Forum;