docs: consolidate docs (#2182)

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-07-21 22:36:46 +02:00 committed by GitHub
parent 8d46d7e39e
commit ecffebc43c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
307 changed files with 1474 additions and 487 deletions

View file

@ -10,9 +10,11 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Adds an alias to an existing note.
*
* @param noteIdOrAlias The note id or an existing alias for a note.
* @param newAlias The new alias.
* @return Information about the newly created alias.
* @throws {Error} when the api request wasn't successfull
*/
export const addAlias = async (noteIdOrAlias: string, newAlias: string): Promise<Alias> => {
const response = await new PostApiRequestBuilder<Alias, NewAliasDto>('alias')
@ -27,8 +29,10 @@ export const addAlias = async (noteIdOrAlias: string, newAlias: string): Promise
/**
* Marks a given alias as the primary one for a note.
* The former primary alias should be marked as non-primary by the backend automatically.
*
* @param alias The alias to mark as primary for its corresponding note.
* @return The updated information about the alias.
* @throws {Error} when the api request wasn't successfull
*/
export const markAliasAsPrimary = async (alias: string): Promise<Alias> => {
const response = await new PutApiRequestBuilder<Alias, PrimaryAliasDto>('alias/' + alias)
@ -41,7 +45,9 @@ export const markAliasAsPrimary = async (alias: string): Promise<Alias> => {
/**
* Removes a given alias from its corresponding note.
*
* @param alias The alias to remove from its note.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteAlias = async (alias: string): Promise<void> => {
await new DeleteApiRequestBuilder('alias/' + alias).sendRequest()

View file

@ -7,7 +7,8 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Requests to log out the current user.
* @throws Error if logout is not possible.
*
* @throws {Error} if logout is not possible.
*/
export const doLogout = async (): Promise<void> => {
await new DeleteApiRequestBuilder('auth/logout').sendRequest()

View file

@ -9,11 +9,13 @@ import { AuthError } from './types'
import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-request-builder'
/**
* Requests to login a user via LDAP credentials.
* Requests to log in a user via LDAP credentials.
*
* @param provider The identifier of the LDAP provider with which to login.
* @param username The username with which to try the login.
* @param password The password of the user.
* @throws {AuthError.INVALID_CREDENTIALS} if the LDAP provider denied the given credentials.
* @throws {Error} when the api request wasn't successfull
*/
export const doLdapLogin = async (provider: string, username: string, password: string): Promise<void> => {
await new PostApiRequestBuilder<void, LoginDto>('auth/ldap/' + provider)

View file

@ -10,10 +10,12 @@ import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-requ
/**
* Requests to do a local login with a provided username and password.
*
* @param username The username for which the login should be tried.
* @param password The password which should be used to log in.
* @throws {AuthError.INVALID_CREDENTIALS} when the username or password is wrong.
* @throws {AuthError.LOGIN_DISABLED} when the local login is disabled on the backend.
* @throws {Error} when the api request wasn't successful.
*/
export const doLocalLogin = async (username: string, password: string): Promise<void> => {
await new PostApiRequestBuilder<void, LoginDto>('auth/local/login')
@ -30,11 +32,13 @@ export const doLocalLogin = async (username: string, password: string): Promise<
/**
* Requests to register a new local user in the backend.
*
* @param username The username of the new user.
* @param displayName The display name of the new user.
* @param password The password of the new user.
* @throws {RegisterError.USERNAME_EXISTING} when there is already an existing user with the same username.
* @throws {RegisterError.REGISTRATION_DISABLED} when the registration of local users has been disabled on the backend.
* @throws {Error} when the api request wasn't successful.
*/
export const doLocalRegister = async (username: string, displayName: string, password: string): Promise<void> => {
await new PostApiRequestBuilder<void, RegisterDto>('auth/local')

View file

@ -29,7 +29,7 @@ export abstract class ApiRequestBuilderWithBody<ResponseType, RequestBodyType> e
*
* @param bodyData The data to use as request body. Will get stringified to JSON.
* @return The API request instance itself for chaining.
* @see {withBody}
* @see withBody
*/
withJsonBody(bodyData: RequestBodyType): this {
this.withHeader('Content-Type', 'application/json')

View file

@ -108,7 +108,7 @@ export abstract class ApiRequestBuilder<ResponseType> {
* Send the prepared API call as a GET request. A default status code of 200 is expected.
*
* @return The API response.
* @throws Error when the status code does not match the expected one or is defined as in the custom status code
* @throws {Error} when the status code does not match the expected one or is defined as in the custom status code
* error mapping.
*/
abstract sendRequest(): Promise<ApiResponse<ResponseType>>

View file

@ -11,14 +11,14 @@ import { ApiRequestBuilderWithBody } from './api-request-builder-with-body'
*
* @param ResponseType The type of the expected response. Defaults to no response body.
* @param RequestBodyType The type of the request body. Defaults to no request body.
* @see {ApiRequestBuilder}
* @see ApiRequestBuilder
*/
export class DeleteApiRequestBuilder<ResponseType = void, RequestBodyType = unknown> extends ApiRequestBuilderWithBody<
ResponseType,
RequestBodyType
> {
/**
* @see {ApiRequestBuilder#sendRequest}
* @see ApiRequestBuilder#sendRequest
*/
sendRequest(): Promise<ApiResponse<ResponseType>> {
return this.sendRequestAndVerifyResponse('DELETE', 204)

View file

@ -11,11 +11,11 @@ import type { ApiResponse } from '../api-response'
* Builder to construct a GET request to the API.
*
* @param ResponseType The type of the expected response.
* @see {ApiRequestBuilder}
* @see ApiRequestBuilder
*/
export class GetApiRequestBuilder<ResponseType> extends ApiRequestBuilder<ResponseType> {
/**
* @see {ApiRequestBuilder#sendRequest}
* @see ApiRequestBuilder#sendRequest
*/
sendRequest(): Promise<ApiResponse<ResponseType>> {
return this.sendRequestAndVerifyResponse('GET', 200)

View file

@ -11,14 +11,14 @@ import { ApiRequestBuilderWithBody } from './api-request-builder-with-body'
*
* @param ResponseType The type of the expected response.
* @param RequestBodyType The type of the request body
* @see {ApiRequestBuilder}
* @see ApiRequestBuilder
*/
export class PostApiRequestBuilder<ResponseType, RequestBodyType> extends ApiRequestBuilderWithBody<
ResponseType,
RequestBodyType
> {
/**
* @see {ApiRequestBuilder#sendRequest}
* @see ApiRequestBuilder#sendRequest
*/
sendRequest(): Promise<ApiResponse<ResponseType>> {
return this.sendRequestAndVerifyResponse('POST', 201)

View file

@ -11,14 +11,14 @@ import { ApiRequestBuilderWithBody } from './api-request-builder-with-body'
*
* @param ResponseType The type of the expected response.
* @param RequestBodyType The type of the request body
* @see {ApiRequestBuilder}
* @see ApiRequestBuilder
*/
export class PutApiRequestBuilder<ResponseType, RequestBodyType> extends ApiRequestBuilderWithBody<
ResponseType,
RequestBodyType
> {
/**
* @see {ApiRequestBuilder#sendRequest}
* @see ApiRequestBuilder#sendRequest
*/
sendRequest(): Promise<ApiResponse<ResponseType>> {
return this.sendRequestAndVerifyResponse('PUT', 200)

View file

@ -7,7 +7,15 @@
import { defaultConfig } from '../../default-config'
import { Mock } from 'ts-mockery'
export const expectFetch = (expectedUrl: string, expectedStatusCode: number, expectedOptions: RequestInit): void => {
/**
* Mock fetch api for tests.
* Check that the given url and options are present in the request and return the given status code.
*
* @param expectedUrl the url that should be requested
* @param requestStatusCode the status code the mocked request should return
* @param expectedOptions additional options
*/
export const expectFetch = (expectedUrl: string, requestStatusCode: number, expectedOptions: RequestInit): void => {
global.fetch = jest.fn((fetchUrl: RequestInfo | URL, fetchOptions?: RequestInit): Promise<Response> => {
expect(fetchUrl).toEqual(expectedUrl)
expect(fetchOptions).toStrictEqual({
@ -18,7 +26,7 @@ export const expectFetch = (expectedUrl: string, expectedStatusCode: number, exp
})
return Promise.resolve(
Mock.of<Response>({
status: expectedStatusCode
status: requestStatusCode
})
)
})

View file

@ -12,6 +12,7 @@ export class ApiResponse<ResponseType> {
/**
* Initializes a new API response instance based on an HTTP response.
*
* @param response The HTTP response from the fetch call.
*/
constructor(response: Response) {
@ -31,7 +32,7 @@ export class ApiResponse<ResponseType> {
* Returns the response as parsed JSON. An error will be thrown if the response is not JSON encoded.
*
* @return The parsed JSON response.
* @throws Error if the response is not JSON encoded.
* @throws {Error} if the response is not JSON encoded.
*/
async asParsedJsonObject(): Promise<ResponseType> {
if (!this.response.headers.get('Content-Type')?.startsWith('application/json')) {

View file

@ -9,7 +9,9 @@ import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-requ
/**
* Fetches the frontend config from the backend.
*
* @return The frontend config.
* @throws {Error} when the api request wasn't successful.
*/
export const getConfig = async (): Promise<Config> => {
const response = await new GetApiRequestBuilder<Config>('config').sendRequest()

View file

@ -9,8 +9,10 @@ import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-requ
/**
* Retrieves information about a group with a given name.
*
* @param groupName The name of the group.
* @return Information about the group.
* @throws {Error} when the api request wasn't successful.
*/
export const getGroup = async (groupName: string): Promise<GroupInfo> => {
const response = await new GetApiRequestBuilder<GroupInfo>('groups/' + groupName).sendRequest()

View file

@ -1,18 +1,30 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { HistoryEntry, HistoryEntryPutDto, HistoryEntryWithOrigin } from './types'
import { HistoryEntryOrigin } from './types'
export const addRemoteOriginToHistoryEntry = (entryDto: HistoryEntry): HistoryEntryWithOrigin => {
/**
* Transform a {@link HistoryEntry} into a {@link HistoryEntryWithOrigin}.
*
* @param entry the entry to build from
* @return the history entry with an origin
*/
export const addRemoteOriginToHistoryEntry = (entry: HistoryEntry): HistoryEntryWithOrigin => {
return {
...entryDto,
...entry,
origin: HistoryEntryOrigin.REMOTE
}
}
/**
* Create a {@link HistoryEntryPutDto} from a {@link HistoryEntry}.
*
* @param entry the entry to build the dto from
* @return the dto for the api
*/
export const historyEntryToHistoryEntryPutDto = (entry: HistoryEntry): HistoryEntryPutDto => {
return {
pinStatus: entry.pinStatus,

View file

@ -11,7 +11,9 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Fetches the remote history for the user from the server.
*
* @return The remote history entries of the user.
* @throws {Error} when the api request wasn't successful.
*/
export const getRemoteHistory = async (): Promise<HistoryEntry[]> => {
const response = await new GetApiRequestBuilder<HistoryEntry[]>('me/history').sendRequest()
@ -20,7 +22,9 @@ export const getRemoteHistory = async (): Promise<HistoryEntry[]> => {
/**
* Replaces the remote history of the user with the given history entries.
*
* @param entries The history entries to store remotely.
* @throws {Error} when the api request wasn't successful.
*/
export const setRemoteHistoryEntries = async (entries: HistoryEntryPutDto[]): Promise<void> => {
await new PostApiRequestBuilder<void, HistoryEntryPutDto[]>('me/history').withJsonBody(entries).sendRequest()
@ -28,8 +32,10 @@ export const setRemoteHistoryEntries = async (entries: HistoryEntryPutDto[]): Pr
/**
* Updates a remote history entry's pin state.
*
* @param noteIdOrAlias The note id for which to update the pinning state.
* @param pinStatus True when the note should be pinned, false otherwise.
* @throws {Error} when the api request wasn't successful.
*/
export const updateRemoteHistoryEntryPinStatus = async (
noteIdOrAlias: string,
@ -45,7 +51,9 @@ export const updateRemoteHistoryEntryPinStatus = async (
/**
* Deletes a remote history entry.
*
* @param noteIdOrAlias The note id or alias of the history entry to remove.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteRemoteHistoryEntry = async (noteIdOrAlias: string): Promise<void> => {
await new DeleteApiRequestBuilder('me/history/' + noteIdOrAlias).sendRequest()
@ -53,6 +61,8 @@ export const deleteRemoteHistoryEntry = async (noteIdOrAlias: string): Promise<v
/**
* Deletes the complete remote history.
*
* @throws {Error} when the api request wasn't successful.
*/
export const deleteRemoteHistory = async (): Promise<void> => {
await new DeleteApiRequestBuilder('me/history').sendRequest()

View file

@ -11,8 +11,9 @@ import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-re
/**
* Returns metadata about the currently signed-in user from the API.
* @throws Error when the user is not signed-in.
*
* @return The user metadata.
* @throws {Error} when the user is not signed-in.
*/
export const getMe = async (): Promise<LoginUserInfo> => {
const response = await new GetApiRequestBuilder<LoginUserInfo>('me').sendRequest()
@ -21,6 +22,8 @@ export const getMe = async (): Promise<LoginUserInfo> => {
/**
* Deletes the current user from the server.
*
* @throws {Error} when the api request wasn't successful.
*/
export const deleteUser = async (): Promise<void> => {
await new DeleteApiRequestBuilder('me').sendRequest()
@ -28,7 +31,9 @@ export const deleteUser = async (): Promise<void> => {
/**
* Changes the display name of the current user.
*
* @param displayName The new display name to set.
* @throws {Error} when the api request wasn't successful.
*/
export const updateDisplayName = async (displayName: string): Promise<void> => {
await new PostApiRequestBuilder<void, ChangeDisplayNameDto>('me/profile')
@ -40,7 +45,9 @@ export const updateDisplayName = async (displayName: string): Promise<void> => {
/**
* Retrieves a list of media belonging to the user.
*
* @return List of media object information.
* @throws {Error} when the api request wasn't successful.
*/
export const getMyMedia = async (): Promise<MediaUpload[]> => {
const response = await new GetApiRequestBuilder<MediaUpload[]>('me/media').sendRequest()

View file

@ -9,8 +9,10 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Requests an image-proxy URL from the backend for a given image URL.
*
* @param imageUrl The image URL which should be proxied.
* @return The proxy URL for the image.
* @throws {Error} when the api request wasn't successful.
*/
export const getProxiedUrl = async (imageUrl: string): Promise<ImageProxyResponse> => {
const response = await new PostApiRequestBuilder<ImageProxyResponse, ImageProxyRequestDto>('media/proxy')
@ -23,9 +25,11 @@ export const getProxiedUrl = async (imageUrl: string): Promise<ImageProxyRespons
/**
* Uploads a media file to the backend.
*
* @param noteIdOrAlias The id or alias of the note from which the media is uploaded.
* @param media The binary media content.
* @return The URL of the uploaded media object.
* @throws {Error} when the api request wasn't successful.
*/
export const uploadFile = async (noteIdOrAlias: string, media: Blob): Promise<MediaUpload> => {
const postData = new FormData()
@ -40,7 +44,9 @@ export const uploadFile = async (noteIdOrAlias: string, media: Blob): Promise<Me
/**
* Deletes some uploaded media object.
*
* @param mediaId The identifier of the media object to delete.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteUploadedMedia = async (mediaId: string): Promise<void> => {
await new DeleteApiRequestBuilder('media/' + mediaId).sendRequest()

View file

@ -11,8 +11,10 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Retrieves the content and metadata about the specified note.
*
* @param noteIdOrAlias The id or alias of the note.
* @return Content and metadata of the specified note.
* @throws {Error} when the api request wasn't successful.
*/
export const getNote = async (noteIdOrAlias: string): Promise<Note> => {
const response = await new GetApiRequestBuilder<Note>('notes/' + noteIdOrAlias)
@ -23,8 +25,10 @@ export const getNote = async (noteIdOrAlias: string): Promise<Note> => {
/**
* Returns a list of media objects associated with the specified note.
*
* @param noteIdOrAlias The id or alias of the note.
* @return List of media object metadata associated with specified note.
* @throws {Error} when the api request wasn't successful.
*/
export const getMediaForNote = async (noteIdOrAlias: string): Promise<MediaUpload[]> => {
const response = await new GetApiRequestBuilder<MediaUpload[]>(`notes/${noteIdOrAlias}/media`).sendRequest()
@ -33,8 +37,10 @@ export const getMediaForNote = async (noteIdOrAlias: string): Promise<MediaUploa
/**
* Creates a new note with a given markdown content.
*
* @param markdown The content of the new note.
* @return Content and metadata of the new note.
* @throws {Error} when the api request wasn't successful.
*/
export const createNote = async (markdown: string): Promise<Note> => {
const response = await new PostApiRequestBuilder<Note, void>('notes')
@ -46,9 +52,11 @@ export const createNote = async (markdown: string): Promise<Note> => {
/**
* Creates a new note with a given markdown content and a defined primary alias.
*
* @param markdown The content of the new note.
* @param primaryAlias The primary alias of the new note.
* @return Content and metadata of the new note.
* @throws {Error} when the api request wasn't successful.
*/
export const createNoteWithPrimaryAlias = async (markdown: string, primaryAlias: string): Promise<Note> => {
const response = await new PostApiRequestBuilder<Note, void>('notes/' + primaryAlias)
@ -60,7 +68,9 @@ export const createNoteWithPrimaryAlias = async (markdown: string, primaryAlias:
/**
* Deletes the specified note.
*
* @param noteIdOrAlias The id or alias of the note to delete.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteNote = async (noteIdOrAlias: string): Promise<void> => {
await new DeleteApiRequestBuilder('notes/' + noteIdOrAlias).sendRequest()

View file

@ -10,9 +10,11 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Sets the owner of a note.
*
* @param noteId The id of the note.
* @param owner The username of the new owner.
* @return The updated note permissions.
* @return The updated {@link NotePermissions}.
* @throws {Error} when the api request wasn't successful.
*/
export const setNoteOwner = async (noteId: string, owner: string): Promise<NotePermissions> => {
const response = await new PutApiRequestBuilder<NotePermissions, OwnerChangeDto>(
@ -27,9 +29,12 @@ export const setNoteOwner = async (noteId: string, owner: string): Promise<NoteP
/**
* Sets a permission for one user of a note.
*
* @param noteId The id of the note.
* @param username The username of the user to set the permission for.
* @param canEdit true if the user should be able to update the note, false otherwise.
* @return The updated {@link NotePermissions}.
* @throws {Error} when the api request wasn't successful.
*/
export const setUserPermission = async (
noteId: string,
@ -48,9 +53,12 @@ export const setUserPermission = async (
/**
* Sets a permission for one group of a note.
*
* @param noteId The id of the note.
* @param groupName The name of the group to set the permission for.
* @param canEdit true if the group should be able to update the note, false otherwise.
* @return The updated {@link NotePermissions}.
* @throws {Error} when the api request wasn't successful.
*/
export const setGroupPermission = async (
noteId: string,
@ -69,8 +77,11 @@ export const setGroupPermission = async (
/**
* Removes the permissions of a note for a user.
*
* @param noteId The id of the note.
* @param username The name of the user to remove the permission of.
* @return The updated {@link NotePermissions}.
* @throws {Error} when the api request wasn't successful.
*/
export const removeUserPermission = async (noteId: string, username: string): Promise<NotePermissions> => {
const response = await new DeleteApiRequestBuilder<NotePermissions>(
@ -83,8 +94,11 @@ export const removeUserPermission = async (noteId: string, username: string): Pr
/**
* Removes the permissions of a note for a group.
*
* @param noteId The id of the note.
* @param groupName The name of the group to remove the permission of.
* @return The updated {@link NotePermissions}.
* @throws {Error} when the api request wasn't successful.
*/
export const removeGroupPermission = async (noteId: string, groupName: string): Promise<NotePermissions> => {
const response = await new DeleteApiRequestBuilder<NotePermissions>(

View file

@ -9,9 +9,11 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Retrieves a note revision while using a cache for often retrieved revisions.
*
* @param noteId The id of the note for which to fetch the revision.
* @param revisionId The id of the revision to fetch.
* @return The revision.
* @throws {Error} when the api request wasn't successful.
*/
export const getRevision = async (noteId: string, revisionId: number): Promise<RevisionDetails> => {
const response = await new GetApiRequestBuilder<RevisionDetails>(
@ -22,8 +24,10 @@ export const getRevision = async (noteId: string, revisionId: number): Promise<R
/**
* Retrieves a list of all revisions stored for a given note.
*
* @param noteId The id of the note for which to look up the stored revisions.
* @return A list of revision ids.
* @throws {Error} when the api request wasn't successful.
*/
export const getAllRevisions = async (noteId: string): Promise<RevisionMetadata[]> => {
const response = await new GetApiRequestBuilder<RevisionMetadata[]>(`notes/${noteId}/revisions`).sendRequest()
@ -32,7 +36,9 @@ export const getAllRevisions = async (noteId: string): Promise<RevisionMetadata[
/**
* Deletes all revisions for a note.
*
* @param noteIdOrAlias The id or alias of the note to delete all revisions for.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteRevisionsForNote = async (noteIdOrAlias: string): Promise<void> => {
await new DeleteApiRequestBuilder(`notes/${noteIdOrAlias}/revisions`).sendRequest()

View file

@ -10,7 +10,9 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Retrieves the access tokens for the current user.
*
* @return List of access token metadata.
* @throws {Error} when the api request wasn't successful.
*/
export const getAccessTokenList = async (): Promise<AccessToken[]> => {
const response = await new GetApiRequestBuilder<AccessToken[]>('tokens').sendRequest()
@ -19,9 +21,11 @@ export const getAccessTokenList = async (): Promise<AccessToken[]> => {
/**
* Creates a new access token for the current user.
*
* @param label The user-defined label for the new access token.
* @param validUntil The user-defined expiry date of the new access token in milliseconds of unix time.
* @return The new access token metadata along with its secret.
* @throws {Error} when the api request wasn't successful.
*/
export const postNewAccessToken = async (label: string, validUntil: number): Promise<AccessTokenWithSecret> => {
const response = await new PostApiRequestBuilder<AccessTokenWithSecret, CreateAccessTokenDto>('tokens')
@ -35,7 +39,9 @@ export const postNewAccessToken = async (label: string, validUntil: number): Pro
/**
* Removes an access token from the current user account.
*
* @param keyId The key id of the access token to delete.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteAccessToken = async (keyId: string): Promise<void> => {
await new DeleteApiRequestBuilder('tokens/' + keyId).sendRequest()

View file

@ -9,8 +9,10 @@ import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-requ
/**
* Retrieves information about a specific user while using a cache to avoid many requests for the same username.
*
* @param username The username of interest.
* @return Metadata about the requested user.
* @throws {Error} when the api request wasn't successful.
*/
export const getUser = async (username: string): Promise<UserInfo> => {
const response = await new GetApiRequestBuilder<UserInfo>('users/' + username).sendRequest()