Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EntityService<T>

A Class that defines the base Entity Model

example
//Most methods on the entity are fluent (chainable)
var job = new Entity('JobOrder').fields('title');
//the 'fields' function created a getter and setter for 'title'
job.title = 'My New Job';
job.save();

Type parameters

  • T

Hierarchy

  • EntityService

Index

Constructors

constructor

Properties

Protected _fields

_fields: string[] = []

Protected endpoint

endpoint: string

Protected http

http: AxiosInstance

meta

Protected parameters

parameters: any

type

type: string

Methods

delete

  • delete(id?: number): Promise<AxiosResponse>

fields

  • fields(...args: any[]): this
  • Define the fields to set or retrieve for the given entity. Getter and Setter methods will automagically be set up on the entity once the fields are defined.

    Parameters

    • Rest ...args: any[]

      fields can either be sent as a list of arguments or as an Array

    Returns this

get

params

  • params(object: any): this
  • Will merge object into the entity's parameter to be sent in any http request.

    Parameters

    • object: any

      all additional parameters

    Returns this

save

  • save(value: any): Promise<AxiosResponse>
  • Create or Updates the entity based on the presence of an 'id' property

    Parameters

    • value: any

    Returns Promise<AxiosResponse>

Generated using TypeDoc