Skip to content

Commit

Permalink
fix: Fix naming convention for Admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Mar 25, 2021
1 parent 69f6131 commit c5759cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
19 changes: 8 additions & 11 deletions src/repositories/admin/account-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
fetchAccounts(params?: AdminFetchAccountParams): Promise<Admin.Account[]> {
fetchAll(params?: AdminFetchAccountParams): Promise<Admin.Account[]> {
return this.http.get('/api/v1/admin/accounts', params);
}

Expand All @@ -73,7 +73,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
fetchAccount(id: string): Promise<Admin.Account> {
fetch(id: string): Promise<Admin.Account> {
return this.http.get(`/api/v1/admin/accounts/${id}`);
}

Expand All @@ -85,10 +85,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
actionAccount(
id: string,
params: AdminActionAccountParams,
): Promise<Admin.Account> {
createAction(id: string, params: AdminActionAccountParams): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/action`, params);
}

Expand All @@ -99,7 +96,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
approveAccount(id: string): Promise<Admin.Account> {
approve(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/approve`);
}

Expand All @@ -110,7 +107,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
rejectAccount(id: string): Promise<Admin.Account> {
reject(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/reject`);
}

Expand All @@ -121,7 +118,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
enableAccount(id: string): Promise<Admin.Account> {
enable(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/enable`);
}

Expand All @@ -132,7 +129,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
unsilenceAccount(id: string): Promise<Admin.Account> {
unsilence(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/unsilence`);
}

Expand All @@ -143,7 +140,7 @@ export class AccountRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
unsuspendAccount(id: string): Promise<Admin.Account> {
unsuspend(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/unsuspend`);
}
}
12 changes: 6 additions & 6 deletions src/repositories/admin/report-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
fetchReports(params?: AdminFetchReportsParams): Promise<Admin.Report[]> {
fetchAll(params?: AdminFetchReportsParams): Promise<Admin.Report[]> {
return this.http.get('/api/v1/admin/reports', params);
}

Expand All @@ -30,7 +30,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
fetchReport(id: string): Promise<Admin.Report> {
fetch(id: string): Promise<Admin.Report> {
return this.http.get(`/api/v1/admin/reports/${id}`);
}

Expand All @@ -41,7 +41,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
assignReportToSelf(id: string): Promise<Admin.Report> {
assignToSelf(id: string): Promise<Admin.Report> {
return this.http.post(`/api/v1/admin/reports/${id}/assign_to_self`);
}

Expand All @@ -52,7 +52,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
unassignReport(id: string): Promise<Admin.Report> {
unassign(id: string): Promise<Admin.Report> {
return this.http.post(`/api/v1/admin/reports/${id}/unassign`);
}

Expand All @@ -63,7 +63,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
resolveReport(id: string): Promise<Admin.Report> {
resolve(id: string): Promise<Admin.Report> {
return this.http.post(`/api/v1/admin/reports/${id}/resolve`);
}

Expand All @@ -74,7 +74,7 @@ export class ReportRepository {
* @see https://docs.joinmastodon.org/methods/admin/
*/
@version({ since: '2.9.1' })
reopenReport(id: string): Promise<Admin.Report> {
reopen(id: string): Promise<Admin.Report> {
return this.http.post(`/api/v1/admin/reports/${id}/reopen`);
}
}

0 comments on commit c5759cd

Please sign in to comment.