Hierarchy

  • Nymph

    Constructors

    Properties

    Entity: typeof Entity

    The entity class for this instance of Nymph.

    cache: default = ...

    The entity cache.

    entityClasses: {
        [k: string]: EntityConstructor;
    } = {}

    A simple map of names to Entity classes.

    Type declaration

    headers: {
        [k: string]: string;
    } = {}

    Headers that will be sent with every request.

    These are used by Tilmeld for authentication.

    Type declaration

    • [k: string]: string
    pubsub: undefined | PubSub = undefined

    And optional PubSub client instance.

    requestCallbacks: RequestCallback[] = []
    responseCallbacks: ResponseCallback[] = []
    restUrl: string = ''
    weakCache: boolean = false

    Methods

    • Add your class to this instance.

      This will create a class that extends your class within this instance of Nymph and return it. You can then use this class's constructor and methods, which will use this instance of Nymph.

      Because this creates a subclass, don't use the class returned from getEntityClass to check with instanceof.

      Type Parameters

      Parameters

      • entityClass: T

      Returns T

    • Type Parameters

      Parameters

      • entity: T
      • method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
      • data: {
            [k: string]: any;
        }
        • [k: string]: any
      • plural: false

      Returns Promise<T>

    • Type Parameters

      Parameters

      • entity: T[]
      • method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
      • data: {
            [k: string]: any;
        }
        • [k: string]: any
      • plural: true

      Returns Promise<T[]>

    • Parameters

      • className: string
      • method: string
      • params: any[]

      Returns Promise<any>