Skip to content

Commit

Permalink
Merge pull request #2211 from Ryuno-Ki/gotosocial_only_public
Browse files Browse the repository at this point in the history
feat: add another option to GoToSocial API
  • Loading branch information
h3poteto authored Sep 29, 2024
2 parents fc36655 + 05e0afc commit aea2459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions megalodon/src/gotosocial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ export default class Gotosocial implements MegalodonInterface {
* @param options.exclude_replies Return statuses which exclude replies.
* @param options.exclude_reblogs Return statuses which exclude reblogs.
* @param options.only_media Show only statuses with media attached? Defaults to false.
* @param options.only_public Return statuses with public visibility only.
* @return Account's statuses.
*/
public async getAccountStatuses(
Expand All @@ -369,6 +370,7 @@ export default class Gotosocial implements MegalodonInterface {
exclude_replies?: boolean
exclude_reblogs?: boolean
only_media: boolean
only_public?: boolean
}
): Promise<Response<Array<Entity.Status>>> {
let params = {}
Expand Down Expand Up @@ -413,6 +415,11 @@ export default class Gotosocial implements MegalodonInterface {
only_media: options.only_media
})
}
if (options.only_public) {
params = Object.assign(params, {
only_public: options.only_public
})
}
}
return this.client.get<Array<GotosocialAPI.Entity.Status>>(`/api/v1/accounts/${id}/statuses`, params).then(res => {
return Object.assign(res, {
Expand Down
2 changes: 2 additions & 0 deletions megalodon/src/megalodon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export interface MegalodonInterface {
* @param options.exclude_replies Return statuses which exclude replies.
* @param options.exclude_reblogs Return statuses which exclude reblogs.
* @param options.only_media Show only statuses with media attached? Defaults to false.
* @param options.only_public Return statuses with public visibility only.
* @return Account's statuses.
*/
getAccountStatuses(
Expand All @@ -182,6 +183,7 @@ export interface MegalodonInterface {
exclude_replies?: boolean
exclude_reblogs?: boolean
only_media?: boolean
only_public?: boolean
}
): Promise<Response<Array<Entity.Status>>>
/**
Expand Down

0 comments on commit aea2459

Please sign in to comment.