Show:

Methods

attr

(
  • caption
  • [options]
)
Object public

Define plain attribute in projection.

Parameters:

  • caption String

    A user-friendly caption for attribute.

  • [options] Object optional

    Attribute options.

Returns:

Object:

Projection attribute.

belongsTo

(
  • modelName
  • caption
  • attributes
  • [options]
)
Object public

Define belongsTo relationship attribute in projection.

Parameters:

  • modelName String

    The name of the model type.

  • caption String

    A user-friendly caption for attribute.

  • attributes Object

    Projection attributes.

  • [options] Object optional

    Attribute options.

Returns:

Object:

Projection attribute.

create

(
  • modelName
  • attributes
  • projectionName
)
Object public

Creates model projection.

Parameters:

  • modelName String

    The name of the model type.

  • attributes Object

    Projection attributes.

  • projectionName String

    The name of the projection type.

Returns:

Object:

Model projection.

getBatchResponses

(
  • response
  • boundary
)
String[]

Returns an array of batch responses from the body of the HTTP response.

Parameters:

  • response String

    The body of the HTTP response.

  • boundary String

    The boundary.

Returns:

String[]:

An array of batch responses.

getResponseHeader

(
  • header
  • response
)
String private

Parameters:

  • header String

    The header name.

  • response String

    The response from which will be extracted header.

Returns:

String:

The content of the header.

getResponseMeta

(
  • contentTypeHeader
)
Object

Returns the type and boundary from the Content-Type header.

Parameters:

  • contentTypeHeader String

    The content of Content-Type header.

Returns:

Object:

Object with contentType and boundary properties.

hasMany

(
  • modelName
  • caption
  • attributes
  • [options]
)
Object public

Define hasMany relationship attribute in projection.

Parameters:

  • modelName String

    The name of the model type.

  • caption String

    A user-friendly caption for attribute.

  • attributes Object

    Projection attributes.

  • [options] Object optional

    Attribute options.

Returns:

Object:

Projection attribute.

parseBatchResponse

(
  • response
)
Object

Parses a batch response depending on its type.

The returned object always contains the contentType property. Depending on the type of response it may contain the following additional properties:

  • response - for responses with application/http content type.
  • changesets - for responses with multipart/mixed content type.

Parameters:

  • response String

    The batch response.

Returns:

Object:

The object with the response description.

parseResponse

(
  • response
)
Object private

Parameters:

  • response String

    The string with the response content.

Returns:

Object:

Object with meta and body properties.

parseResponseMeta

(
  • rawMeta
)
Object private

Parameters:

  • rawMeta String

    The string with the response metadata.

Returns:

Object:

Object with status, statusText and contentType properties.

parseСhangeset

(
  • changeset
)
Object private

Parameters:

  • changeset String

    The string with the changeset content.

Returns:

Object:

Object with contentID, meta and body properties.