t

dynamics.http

EntityDecoderInstances

trait EntityDecoderInstances extends AnyRef

EntityDecoder instances specific to the type you want to "output" from the decoding process. Currently tied to IO.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EntityDecoderInstances
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def ExpectOnlyOne[A <: Object](implicit ec: ExecutionContext): EntityDecoder[IO, A]

    Use this when you expect only one value in an array or return an error.

    Use this when you expect only one value in an array or return an error.

    Example:
    1. val q = QuerySpec(...) // select value by name, which should be unique but is not a PK
       dynclient.getOne[Blah](q.url("entitysetname"))(ExpectOnlyOne)
         .map( ... )
         .recover( ... )
  5. def ExpectOnlyOneToOption[A <: Object](implicit ec: ExecutionContext): EntityDecoder[IO, Option[A]]

    Transform a DecodeFailure(OnlyOneExpected) to None if present, otherwise Some.

    Transform a DecodeFailure(OnlyOneExpected) to None if present, otherwise Some. Use as an explicit encoder and use a type of Option[A] e.g. dynamicsclient.getOne[Option[A]](..)(ExpectOnlyOneToOption).

  6. implicit def JSONDecoder(reviver: Option[Reviver] = None)(implicit ec: ExecutionContext): EntityDecoder[IO, Dynamic]

    Pparsed into JSON using JSON.parse().

    Pparsed into JSON using JSON.parse(). Note that JSON parse could return a simple value, not a JS object. Having said that, all response bodies (for valid responses) from the server are objects.

  7. def JSONDecoderValidate(f: (Dynamic) ⇒ Boolean, failedMsg: String = "Failed validation.", reviver: Option[Reviver] = None)(implicit ec: ExecutionContext): EntityDecoder[IO, Dynamic]

    Filter on JSON value.

    Filter on JSON value. Create DecodeFailure if filter func returns false.

  8. def JsObjectDecoder[A <: Object](reviver: Option[Reviver] = None)(implicit ec: ExecutionContext): EntityDecoder[IO, A]

    Decode the body as json and cast to A instead of JSONDecoder which casts the body to js.Dynamic.

    Decode the body as json and cast to A instead of JSONDecoder which casts the body to js.Dynamic. Typebounds implies that JS traits can use this decoder easily.

  9. val ReturnedIdDecoder: EntityDecoder[IO, String]

    A decoder that only looks at the header for an OData-EntityId (case-insensitive) value and returns that, otherwise fail.

    A decoder that only looks at the header for an OData-EntityId (case-insensitive) value and returns that, otherwise fail. To ensure that the id is returned in the header, you must make sure that return=representation is *not* set in the Prefer headers when the HTTP call is issued.

  10. def SingleValueDecoder[A <: Any](implicit ec: ExecutionContext): EntityDecoder[IO, Option[A]]

    Decode based on the expectation of a single value in a fieldname called "value".

    Decode based on the expectation of a single value in a fieldname called "value". You might get this when you navigate to a simple/single value property on a specific entity e.g. '/myentities(theguid)/somesimpleattribute'. A null value or undefined value is automatically taken into account in the returned Option. Preversely, you could assume that "js.Array[YourSomething]" is the single value and use that instead of ValueArrayDecoder.

  11. implicit def TextDecoder(implicit ec: ExecutionContext): EntityDecoder[IO, String]

    Decode body to text.

    Decode body to text. Since the body in a response is already text this is the simplest decoder.

  12. def ValueArrayDecoder[A <: Any](implicit ec: ExecutionContext): EntityDecoder[IO, Array[A]]

    Decode based on the expectation of a "value" field name that has an array of "A" values.

    Decode based on the expectation of a "value" field name that has an array of "A" values. The returned value is a js Array not a scala collection. If "value" fieldname is undefined, return an empty array freshly allocated.

  13. def ValueWrapper[A <: Object](implicit ec: ExecutionContext): EntityDecoder[IO, A]

    Check for value array and if there is a value array return the first element.

    Check for value array and if there is a value array return the first element. Otherwise cast the entire response to A directly and return it. Either way, return a single value of type T. Because of these assumptions, you could get undefined behavior. If there is more than one element in the array, return an OnlyOneExpected error.

    If you are assuming a different underlying decode approach to the raw http body, you need to write your own wrapper to detect the "value" array and decide how to decode based on its presence. That's because its assumed in this function that we will decode to a js.Object first to check for the value array in the response body. This should really be called FirstElementOfValueArrayIfThereIsOneOrCastWholeMessage.

  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  16. val dateRegex: RegExp

    Dates from dynamics server.

    Dates from dynamics server. (js regexp)

    Attributes
    protected
  17. val dateReviver: Reviver

    JSON Date reviver based on ISO string format dateRegex.

    JSON Date reviver based on ISO string format dateRegex. (js)

  18. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  20. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. implicit def jsObjectDecoder[A <: Object](implicit ec: ExecutionContext): EntityDecoder[IO, A]

    Implicit versio of JsObjectDecoder

  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. val reg: Regex

    GUID regex.

    GUID regex. (scala)

  29. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. val undefinedReviver: Reviver

    JSON reviver that matches nothing.

  32. implicit val void: EntityDecoder[IO, Unit]

    Ignore the response completely (status and body) and return decode "unit" success.

    Ignore the response completely (status and body) and return decode "unit" success. You typically use this decoder with a client type parameter of Unit and when you only want to check that a successful status code was returned or error out otherwise.

  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped