Skip to content

Class: CodeEndpoint ​

Defined in: api/endpoints/code/CodeEndpoint.ts:13

Endpoints for interacting with promotional codes.

Extends ​

Constructors ​

Constructor ​

new CodeEndpoint(config, tokenManager, log?, headerProvider?): CodeEndpoint

Defined in: api/endpoints/code/CodeEndpoint.ts:14

Parameters ​

config ​

DefaultApiConfig

tokenManager ​

TokenManager

log? ​

Logger

headerProvider? ​

HeaderProvider

Returns ​

CodeEndpoint

Overrides ​

ApiEndpoint.constructor

Properties ​

config ​

readonly config: DefaultApiConfig

Defined in: api/endpoints/ApiEndpoint.ts:10

Inherited from ​

ApiEndpoint.config


log? ​

protected readonly optional log: Logger

Defined in: api/endpoints/ApiEndpoint.ts:15

Inherited from ​

ApiEndpoint.log


tokenManager ​

readonly tokenManager: TokenManager

Defined in: api/endpoints/ApiEndpoint.ts:14

Inherited from ​

ApiEndpoint.tokenManager

Methods ​

deleteRequest() ​

protected deleteRequest(endpoint, queryParams?, noAuthentication?): Promise<ApiResponse<unknown>>

Defined in: api/endpoints/ApiEndpoint.ts:85

Parameters ​

endpoint ​

string

queryParams? ​
noAuthentication? ​

boolean

Returns ​

Promise<ApiResponse<unknown>>

Inherited from ​

ApiEndpoint.deleteRequest


endpoint() ​

protected endpoint(): string

Defined in: api/endpoints/code/CodeEndpoint.ts:18

Returns ​

string

Overrides ​

ApiEndpoint.endpoint


endpointUrl() ​

protected endpointUrl(): string

Defined in: api/endpoints/ApiEndpoint.ts:23

Returns ​

string

Inherited from ​

ApiEndpoint.endpointUrl


getRedeemedCodes() ​

getRedeemedCodes(): Promise<ApiResponse<PromotionalCode[]>>

Defined in: api/endpoints/code/CodeEndpoint.ts:25

Gets the redeemed codes for the current user.

Returns ​

Promise<ApiResponse<PromotionalCode[]>>


getRequest() ​

protected getRequest<T>(endpoint, queryParams?, noAuthentication?): Promise<ApiResponse<T>>

Defined in: api/endpoints/ApiEndpoint.ts:53

Type Parameters ​

T ​

T = unknown

Parameters ​

endpoint ​

string

queryParams? ​
noAuthentication? ​

boolean

Returns ​

Promise<ApiResponse<T>>

Inherited from ​

ApiEndpoint.getRequest


patchRequest() ​

protected patchRequest<T>(endpoint, data?, noAuthentication?): Promise<ApiResponse<T>>

Defined in: api/endpoints/ApiEndpoint.ts:77

Type Parameters ​

T ​

T = unknown

Parameters ​

endpoint ​

string

data? ​

unknown

noAuthentication? ​

boolean

Returns ​

Promise<ApiResponse<T>>

Inherited from ​

ApiEndpoint.patchRequest


postRequest() ​

protected postRequest<T>(endpoint, data?, noAuthentication?): Promise<ApiResponse<T>>

Defined in: api/endpoints/ApiEndpoint.ts:61

Type Parameters ​

T ​

T = unknown

Parameters ​

endpoint ​

string

data? ​

unknown

noAuthentication? ​

boolean

Returns ​

Promise<ApiResponse<T>>

Inherited from ​

ApiEndpoint.postRequest


putRequest() ​

protected putRequest<T>(endpoint, data?, noAuthentication?): Promise<ApiResponse<T>>

Defined in: api/endpoints/ApiEndpoint.ts:69

Type Parameters ​

T ​

T = unknown

Parameters ​

endpoint ​

string

data? ​

unknown

noAuthentication? ​

boolean

Returns ​

Promise<ApiResponse<T>>

Inherited from ​

ApiEndpoint.putRequest


redeem() ​

redeem(code): Promise<ApiResponse<unknown>>

Defined in: api/endpoints/code/CodeEndpoint.ts:34

Redeems the specified promotional code for the current user

Parameters ​

code ​

string

The code to redeem.

Returns ​

Promise<ApiResponse<unknown>>

Released under the GPL-3.0 License.