Skip to content

Commit d70e0f5

Browse files
committed
Add resource listing by author helper & additional avatar_url field for member object
1 parent b359ee9 commit d70e0f5

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/helpers/members/MembersHelper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const { ProfilePostsHelper } = require("./ProfilePostsHelper.js");
1717
* @property {boolean} supreme
1818
* @property {boolean} ultimate
1919
* @property {number} [discord_id]
20+
* @property {string} avatar_url
2021
* @property {number} post_count
2122
* @property {number} resource_count
2223
* @property {number} purchase_count

src/helpers/resources/ResourcesHelper.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,41 @@ class ResourcesHelper {
118118
return await this.#wrapper.http().listUntil("/resources/collaborated", shouldContinue, sort);
119119
}
120120

121+
/** List a page of resources by an author.
122+
*
123+
* @param {number} authorId The identifier of the resource author.
124+
* @param {SortOptions} sort An optional set of sort options.
125+
*
126+
* @return {Array<BasicResource>} An array of raw data objects.
127+
*/
128+
async listByAuthor(authorId, sort) {
129+
return await this.#wrapper.get(`/resources/authors/${authorId}`, sort);
130+
}
131+
132+
/** List all pages of resources by an author.
133+
*
134+
* @param {number} authorId The identifier of the resource author.
135+
* @param {SortOptions} sort An optional set of sort options.
136+
*
137+
* @return {Array<BasicResource>} An array of raw data objects.
138+
*/
139+
async listByAuthorAll(authorId, sort) {
140+
return await this.#wrapper.http().listUntil(`/resources/authors/${authorId}`, () => true, sort);
141+
}
142+
143+
/** List multiple pages of resources by an author until a condition is no longer met.
144+
*
145+
* @param {number} authorId The identifier of the resource author.
146+
* @param {function(BasicResource):boolean} shouldContinue A function which determines if further pages are
147+
* requested.
148+
* @param {SortOptions} sort An optional set of sort options.
149+
*
150+
* @return {Array<BasicResource>} An array of raw data objects.
151+
*/
152+
async listByAuthorUntil(authorId, shouldContinue, sort) {
153+
return await this.#wrapper.http().listUntil(`/resources/authors/${authorId}`, shouldContinue, sort);
154+
}
155+
121156
/** Fetch detailed information about a resource.
122157
*
123158
* @param {number} resourceId The identifier of the resource.

0 commit comments

Comments
 (0)