Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IPersistence

Provides an accessor write data to the App's persistent storage. A App only has access to its own persistent storage and does not have access to any other App's.

Hierarchy

  • IPersistence

Index

Methods

create

  • create(data: object): Promise<string>
  • Creates a new record in the App's persistent storage, returning the resulting "id".

    Parameters

    • data: object

      the actual data to store, must be an object otherwise it will error out.

    Returns Promise<string>

    the resulting record's id

createWithAssociation

  • Creates a new record in the App's persistent storage with the associated information being provided.

    Parameters

    • data: object

      the actual data to store, must be an object otherwise it will error out

    • association: RocketChatAssociationRecord

      the association data which includes the model and record id

    Returns Promise<string>

    the resulting record's id

createWithAssociations

  • Creates a new record in the App's persistent storage with the data being associated with more than one Rocket.Chat record.

    Parameters

    • data: object

      the actual data to store, must be an object otherwise it will error out

    • associations: Array<RocketChatAssociationRecord>

      an array of association data which includes the model and record id

    Returns Promise<string>

    the resulting record's id

remove

  • remove(id: string): Promise<object>
  • Removes a record by the provided id and returns the removed record.

    Parameters

    • id: string

      of the record to remove

    Returns Promise<object>

    the data record which was removed

removeByAssociation

  • Removes all of the records in persistent storage which are associated with the provided information.

    Parameters

    Returns Promise<Array<object>>

    the data of the removed records

removeByAssociations

  • Removes all of the records in persistent storage which are associated with the provided information. More than one association acts like an AND which means a record in persistent storage must have all of the associations to be considered a match.

    Parameters

    Returns Promise<Array<object>>

    the data of the removed records

update

  • update(id: string, data: object, upsert?: boolean): Promise<string>
  • Updates an existing record with the data provided in the App's persistent storage. This will throw an error if the record doesn't currently exist or if the data is not an object.

    Parameters

    • id: string

      the data record's id

    • data: object

      the actual data to store, must be an object otherwise it will error out

    • Optional upsert: boolean

      whether a record should be created if the id to be updated does not exist

    Returns Promise<string>

    the id of the updated/upserted record

updateByAssociation

  • Updates an existing record with the data provided in the App's persistent storage which are associated with provided information. This will throw an error if the record doesn't currently exist or if the data is not an object.

    Parameters

    • association: RocketChatAssociationRecord

      the association record

    • data: object

      the actual data to store, must be an object otherwise it will error out

    • Optional upsert: boolean

      whether a record should be created if the id to be updated does not exist

    Returns Promise<string>

    the id of the updated/upserted record

updateByAssociations

  • Updates an existing record with the data provided in the App's persistent storage which are associated with more than one Rocket.Chat record. This will throw an error if the record doesn't currently exist or if the data is not an object.

    Parameters

    • associations: Array<RocketChatAssociationRecord>

      an array of association data which includes the model and record id

    • data: object

      the actual data to store, must be an object otherwise it will error out

    • Optional upsert: boolean

      whether a record should be created if the id to be updated does not exist

    Returns Promise<string>

    the id of the updated/upserted record

Generated using TypeDoc