Skip to main content

getResource

Call Signature

getResource<T>(getResourceConfig): Promise<T>

Gets a resource by its id and resourceName from database.

Type Parameters

T

T extends WithId

type of the resource

Parameters

getResourceConfig

GetResourceConfig

Returns

Promise<T>

Call Signature

getResource<T>(getResourceConfig, throwIfNotFound): Promise<T>

Type Parameters

T

T extends WithId

Parameters

getResourceConfig

GetResourceConfig

throwIfNotFound

true

true

Returns

Promise<T>

Call Signature

getResource<T>(getResourceConfig, throwIfNotFound): Promise<undefined | T>

Type Parameters

T

T extends WithId

Parameters

getResourceConfig

GetResourceConfig

throwIfNotFound

boolean

(optional) whether to throw error when resource is not found. Default value - true

Returns

Promise<undefined | T>

Throws

error if throwIfNotFound is true and resource is not found