refs #668 Support notify options in follow for Mastodon
This commit is contained in:
parent
db7061fa51
commit
33cf947ed6
|
@ -446,12 +446,19 @@ export default class Mastodon implements MegalodonInterface {
|
|||
})
|
||||
}
|
||||
|
||||
public async followAccount(id: string, reblog?: boolean): Promise<Response<Entity.Relationship>> {
|
||||
public async followAccount(id: string, options?: { reblog?: boolean; notify?: boolean }): Promise<Response<Entity.Relationship>> {
|
||||
let params = {}
|
||||
if (reblog !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
reblog: reblog
|
||||
})
|
||||
if (options) {
|
||||
if (options.reblog !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
reblog: options.reblog
|
||||
})
|
||||
}
|
||||
if (options.notify !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
notify: options.notify
|
||||
})
|
||||
}
|
||||
}
|
||||
return this.client.post<MastodonAPI.Entity.Relationship>(`/api/v1/accounts/${id}/follow`, params).then(res => {
|
||||
return Object.assign(res, {
|
||||
|
|
|
@ -272,7 +272,13 @@ export interface MegalodonInterface {
|
|||
* @param reblog Receive this account's reblogs in home timeline.
|
||||
* @return Relationship
|
||||
*/
|
||||
followAccount(id: string, reblog?: boolean): Promise<Response<Entity.Relationship>>
|
||||
followAccount(
|
||||
id: string,
|
||||
options?: {
|
||||
reblog?: boolean
|
||||
notify?: boolean
|
||||
}
|
||||
): Promise<Response<Entity.Relationship>>
|
||||
/**
|
||||
* POST /api/v1/accounts/:id/unfollow
|
||||
*
|
||||
|
|
|
@ -454,7 +454,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
/**
|
||||
* POST /api/following/create
|
||||
*/
|
||||
public async followAccount(id: string, _reblog?: boolean): Promise<Response<Entity.Relationship>> {
|
||||
public async followAccount(id: string, _options?: { reblog?: boolean; notify?: boolean }): Promise<Response<Entity.Relationship>> {
|
||||
await this.client.post<{}>('/api/following/create', {
|
||||
userId: id
|
||||
})
|
||||
|
|
|
@ -467,12 +467,19 @@ export default class Pleroma implements MegalodonInterface {
|
|||
})
|
||||
}
|
||||
|
||||
public async followAccount(id: string, reblog?: boolean): Promise<Response<Entity.Relationship>> {
|
||||
public async followAccount(id: string, options?: { reblog?: boolean; notify?: boolean }): Promise<Response<Entity.Relationship>> {
|
||||
let params = {}
|
||||
if (reblog !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
reblog: reblog
|
||||
})
|
||||
if (options) {
|
||||
if (options.reblog !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
reblog: options.reblog
|
||||
})
|
||||
}
|
||||
if (options.notify !== undefined) {
|
||||
params = Object.assign(params, {
|
||||
notify: options.notify
|
||||
})
|
||||
}
|
||||
}
|
||||
return this.client.post<PleromaAPI.Entity.Relationship>(`/api/v1/accounts/${id}/follow`, params).then(res => {
|
||||
return Object.assign(res, {
|
||||
|
|
Loading…
Reference in a new issue