Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Resource

Base class for all DataTrue resource types

Hierarchy

Index

Constructors

constructor

Properties

name

name: string

options

options: ResourceOptions = {}

Static Readonly childTypes

childTypes: readonly string[]

Static Readonly resourceType

resourceType: string

Static Optional Readonly resourceTypeRun

resourceTypeRun?: string

Methods

delete

  • delete(): Promise<void>

getContextID

  • getContextID(): undefined | number
  • Gets the contextID of a resource

    Returns undefined | number

    contextID of the resource

getContextType

  • getContextType(): string

getResourceID

  • getResourceID(): undefined | number
  • Gets the resourceID of a resource

    Returns undefined | number

    resourceID of the resource

save

  • save(): Promise<void>

setContextID

  • setContextID(id: undefined | number): void
  • Sets the contextID of a resource

    Parameters

    • id: undefined | number

      the contextID to set

    Returns void

setOptions

  • setOptions(options: ResourceOptions, override?: boolean): void
  • Set options from the passed options object

    Parameters

    • options: ResourceOptions

      the object to set options from

    • Optional override: boolean

      whether to override the options object

    Returns void

setResourceID

  • setResourceID(id: undefined | number): void
  • Sets the resourceID of a resource

    Parameters

    • id: undefined | number

      the resourceID to set

    Returns void

Abstract toJSON

  • toJSON(): Promise<Record<string, any>>
  • Convert the resource to an Object

    Returns Promise<Record<string, any>>

    object representation of the resource

toString

  • toString(): Promise<string>
  • Convert the resource to a JSON string

    Returns Promise<string>

    the resource represented as a JSON string

Static fromID

  • Create a resource from a given ID

    Parameters

    • id: number

      the ID of the resource

    Returns Promise<Resource>

    Promise of the resource

Static fromJSON

  • fromJSON(obj: Record<string, any>, copy?: boolean): Resource
  • Create a resource from an object

    Parameters

    • obj: Record<string, any>

      object to create resource from

    • copy: boolean = false

      whether to create a copy of the resource or not (removes resource IDs)

    Returns Resource

    new Resource

Generated using TypeDoc