Skip to content

Class: default<DataType>

client/lib/DataStoreManager/structures/GenericDataStore.default

Type parameters

Name Type
DataType any

Hierarchy

  • default

default

default

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new default<DataType>(manager: default, dataStoreType: DataStoreType, placeId: number, name: string, scope: null | string, legacy?: boolean): default<DataType>

Type parameters:

Name Type
DataType unknown

Parameters:

Name Type Default value
manager default -
dataStoreType DataStoreType -
placeId number -
name string -
scope null | string -
legacy boolean false

Returns: default<DataType>

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:28

Properties

advanced

advanced: object

Type declaration:

Name Type
parseData? undefined | (data: string) => DataType
serializeData? undefined | (data: DataType) => string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:25


baseAPIUrl

baseAPIUrl: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:22


dataStoreType

dataStoreType: DataStoreType

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:24


legacy

legacy: boolean

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:21


manager

manager: default

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:18


name

name: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:19


placeId

placeId: number

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:23


scope

scope: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:20

Methods

buildGetUrl

buildGetUrl(): string

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:66


buildIncrementUrl

buildIncrementUrl(key: string, delta: number): string

Parameters:

Name Type
key string
delta number

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:93


buildPostDataForKey

buildPostDataForKey(key: string, index?: number): string

Parameters:

Name Type Default value
key string -
index number 0

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:56


buildRemoveUrl

buildRemoveUrl(key: string): string

Parameters:

Name Type
key string

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:103


buildSetIfUrl

buildSetIfUrl(key: string, valueLength: number, expectedValueLength: number): string

Parameters:

Name Type
key string
valueLength number
expectedValueLength number

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:82


buildSetUrl

buildSetUrl(key: string, valueLength: number): string

Parameters:

Name Type
key string
valueLength number

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:72


createQueryString

createQueryString(addition: Record<string, unknown>): string

Parameters:

Name Type
addition Record<string, unknown>

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:224


getAsync

getAsync(key: string): Promise<unknown>

Retrieves the value associated with the key (if any), otherwise returns null. Equivalent of DataStoreService:GetDataStore("name"):GetAsync("key");

Parameters:

Name Type
key string

Returns: Promise<unknown>

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:134


incrementAsync

incrementAsync(key: string, delta?: number): Promise<RESTResponseDataType>

Parameters:

Name Type Default value
key string -
delta number 1

Returns: Promise<RESTResponseDataType>

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:196


parseIncomingData

PrivateparseIncomingData(data: string): DataType

This will (possibly) use a custom provided converter function that turns string into DataType.

Parameters:

Name Type
data string

Returns: DataType

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:239


parseRetrievedData

parseRetrievedData<Result>(data: string): [boolean, any]

Type parameters:

Name Type
Result unknown

Parameters:

Name Type
data string

Returns: [boolean, any]

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:112


performPreflightChecks

PrivateperformPreflightChecks(options: { key?: undefined | string ; value?: undefined | string }): void

Performs various checks before sending any requests to make sure the requests are valid before sent

Parameters:

Name Type
options object
options.key? undefined | string
options.value? undefined | string

Returns: void

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:287


removeAsync

removeAsync(key: string): Promise<RESTResponseDataType>

Parameters:

Name Type
key string

Returns: Promise<RESTResponseDataType>

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:210


safeEncodeValue

safeEncodeValue(input: string): string

Parameters:

Name Type
input string

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:278


serializeOutgoingData

PrivateserializeOutgoingData(data: DataType): string

This will (possibly) use a custom provided converter function that turns DataType into string so it can be saved to data stores

Parameters:

Name Type
data DataType

Returns: string

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:254


setAsync

setAsync(key: string, value: DataType): Promise<DataType>

Sets a value in data stores to the given key. Equivalent of DataStoreService:GetDataStore("name"):SetAsync("key", "value")

Parameters:

Name Type
key string
value DataType

Returns: Promise<DataType>

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:173


setDataConverters

setDataConverters(parseDataFunction: (data: string) => DataType, serializeDataFunction: (data: DataType) => string): void

When data is retrieved from data stores, it will be returned unmodified Using your own data converter will allow you to return it if you handle your data in a special way, such as JSON parsing it etc.

Parameters:

Name Type
parseDataFunction (data: string) => DataType
serializeDataFunction (data: DataType) => string

Returns: void

Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:51