Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Resource

S222em edited this page May 31, 2022 · 51 revisions

Class: Resource<R>

Base for all resources

Type parameters

Name Type
R extends object & { id?: string }

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Resource<R>(bridge)

Type parameters

Name Type
R extends object & { id?: string }

Parameters

Name Type
bridge Bridge

Inherited from

Base<R>.constructor

Defined in

src/structures/Base.ts:17

Properties

bridge

Readonly bridge: Bridge

The bridge this Base belongs to

Inherited from

Base.bridge

Defined in

src/structures/Base.ts:11


data

data: R

Raw data received from the API

Inherited from

Base.data

Defined in

src/structures/Base.ts:15


type

Abstract type: ApiResourceType

The type of this resource

Defined in

src/structures/Resource.ts:11

Accessors

id

get id(): string

The ID of this resource

Returns

string

Defined in

src/structures/Resource.ts:16

Methods

_clone

_clone(): Resource<R>

Clones this Base

internal

Returns

Resource<R>

Inherited from

Base._clone

Defined in

src/structures/Base.ts:34


_edit

Protected Abstract _edit(options): Promise<void>

Parameters

Name Type
options R

Returns

Promise<void>

Defined in

src/structures/Resource.ts:21


_patch

_patch(data): void

Patches this Base with new data received from the API

internal

Parameters

Name Type Description
data R Data to patch

Returns

void

Inherited from

Base._patch

Defined in

src/structures/Base.ts:26


_update

_update(data): Resource<R>

Clones and patches this Base

internal

Parameters

Name Type Description
data any Data to patch

Returns

Resource<R>

Inherited from

Base._update

Defined in

src/structures/Base.ts:43


fetch

Abstract fetch(): Promise<Resource<any>>

Returns

Promise<Resource<any>>

Defined in

src/structures/Resource.ts:20

hue.ts

Clone this wiki locally