Skip to content

Commit

Permalink
pleroma: Deprecated API replace
Browse files Browse the repository at this point in the history
/api/v1/pleroma/accounts/:id/subscribe
/api/v1/pleroma/accounts/:id/unsubscribe

--
https://git.pleroma.social/pleroma/pleroma/-/releases/v2.8.0
  • Loading branch information
WakuwakuP committed Dec 27, 2024
1 parent 0659090 commit c24cda1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions megalodon/src/pleroma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,27 +460,33 @@ export default class Pleroma implements MegalodonInterface {
}

/**
* POST /api/v1/pleroma/accounts/:id/subscribe
* POST /api/v1/accounts/:id/follow
*
* @param id Target account ID.
* @return Relationship.
*/
public async subscribeAccount(id: string): Promise<Response<Entity.Relationship>> {
return this.client.post<PleromaAPI.Entity.Relationship>(`/api/v1/pleroma/accounts/${id}/subscribe`).then(res => {
const params = {
notify: true
}
return this.client.post<PleromaAPI.Entity.Relationship>(`/api/v1/accounts/${id}/follow`, params).then(res => {
return Object.assign(res, {
data: PleromaAPI.Converter.relationship(res.data)
})
})
}

/**
* POST /api/v1/pleroma/accounts/:id/unsubscribe
* POST /api/v1/accounts/:id/follow
*
* @param id Target account ID.
* @return Relationship.
*/
public async unsubscribeAccount(id: string): Promise<Response<Entity.Relationship>> {
return this.client.post<PleromaAPI.Entity.Relationship>(`/api/v1/pleroma/accounts/${id}/unsubscribe`).then(res => {
const params = {
notify: false
}
return this.client.post<PleromaAPI.Entity.Relationship>(`/api/v1/accounts/${id}/follow`, params).then(res => {
return Object.assign(res, {
data: PleromaAPI.Converter.relationship(res.data)
})
Expand Down

0 comments on commit c24cda1

Please sign in to comment.