Skip to content

Commit

Permalink
feat: Add lookup API
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed May 10, 2021
1 parent 8d3f878 commit 4e1f593
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/repositories/account-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export interface SearchAccountsParams {
readonly following?: boolean | null;
}

export interface LookupAccountParams {
readonly acct: string;
}

export class AccountRepository
implements Repository<Account, CreateAccountParams> {
constructor(private readonly http: Http, readonly version: string) {}
Expand Down Expand Up @@ -345,4 +349,14 @@ export class AccountRepository
fetchIdentityProofs(id: string): Promise<IdentityProof> {
return this.http.get(`/api/v1/accounts/${id}/identity_proofs`);
}

/**
* This method allows to quickly convert a username of a known account to an ID that can be used with the REST API, or to check if a username is available for sign-up
* @param params Parameters
* @return Account
*/
@version({ since: '3.4.0' })
lookup(params: LookupAccountParams): Promise<Account> {
return this.http.get('/api/v1/accounts/lookup', params);
}
}

0 comments on commit 4e1f593

Please sign in to comment.