c

dynamics.client

DynamicsClient

case class DynamicsClient(http: Client[IO], connectInfo: ConnectionInfo, debug: Boolean = false)(implicit F: ApplicativeError[IO, Throwable], e: ExecutionContext) extends LazyLogger with DynamicsClientRequests with ClientMethods with Product with Serializable

Dynamics specific client. Its a thin layer over a basic HTTP client that formulates the HTTP request and minimually interprets the response.

All of the methods either return a IO or a Steam. The IO or Stream must be run in order to execute the operation. Note that the client only captures the most commonly used idioms of using the dynamic web service. It's possible to have cases here this client's API is insufficient for your OData url and you need to go one level deeper e.g. getOne is navigating to a collection valued property and the "array" is in the "value" fieldname.

You must make sure you have a MonadError[IO, Throwable] in implicit scope when you create the client. If you need to you can always val ehandler = MonadError[IO, Throwable] when creating the client to instill your own strategy for raising an error. If you have cats.effect in scope, you should pick up the default one automatically. All errors from responses are captured in this layer and converted to instances of DynamicsClientError (a Throwable). Errors generated from lower levels can be thrown and are *not* captured in this layer.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DynamicsClient
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. ClientMethods
  7. DynamicsClientRequests
  8. LazyLogger
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DynamicsClient(http: Client[IO], connectInfo: ConnectionInfo, debug: Boolean = false)(implicit F: ApplicativeError[IO, Throwable], e: ExecutionContext)

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. val DefaultBatchRequest: HttpRequest[Nothing]
    Definition Classes
    DynamicsClientRequests
  5. def _getList[A <: Any](url: String, headers: HttpHeaders)(): IO[Seq[A]]

    Get a list of values.

    Get a list of values. Follows @data.nextLink but accumulates all the results into memory. Prefer getListStream. For now, the caller must decode external to this method. The url is usually generated from a QuerySpec.

    Attributes
    protected
    Definition Classes
    ClientMethods
  6. def _getListStream[A <: Any](url: String, headers: HttpHeaders): Stream[IO, A]

    Get a list of values as a stream.

    Get a list of values as a stream. Follows @odata.nextLink. For now, the caller must decode external to this method.

    Attributes
    protected
    Definition Classes
    ClientMethods
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def associate(fromEntitySet: String, fromEntityId: String, navProperty: String, toEntitySet: String, toEntityId: String, singleNavProperty: Boolean): IO[Boolean]

    Associate an existing entity to another through a single or collection valued navigation property.

  9. val base: String

    Exposed so you can formulate batch request from standard HttpRequest objects which must have HOST header set or the full URL in the batch item request.

  10. def batch[R](m: Multipart, headers: HttpHeaders = HttpHeaders.empty, opts: DynamicsOptions = QuietDynamicsOptions)(implicit e: EntityEncoder[Multipart], d: EntityDecoder[IO, R]): IO[R]

    Run a batch request.

    Run a batch request. Dynamics batch requests are POSTs.

    headers

    Headers for the post. *not* for each request.

    opts

    dynamics options such as "prefer"

  11. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  12. def create[B, R](entitySet: String, body: B, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit e: EntityEncoder[B], d: EntityDecoder[IO, R]): IO[R]

    Create an entity.

    Create an entity. If return=representation then the decoder can decode the body with entity content. You can return an id or body from this function.

  13. def createReturnId[B](entityCollection: String, body: B, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit e: EntityEncoder[B]): IO[String]

    Create an entity and expect only its id returned.

    Create an entity and expect only its id returned. includeRepresentation is set to an explicit false in the headers to ensure the id is returend in the header.

  14. val debug: Boolean
  15. def delete(entitySet: String, keyInfo: DynamicsId, opts: DynamicsOptions = DefaultDynamicsOptions): IO[(DynamicsId, Boolean)]

    Delete an entity.

    Delete an entity. Return the id passed in for convenience. Return true if the entity does not exist even though this call did not technically delete it if it did not exist already.

    keyInfo

    Primary key (GUID) or alternate key.

    returns

    Pair of the id passed in and true if deleted (204), false if not (404).

  16. def disassociate(fromEntitySet: String, fromEntityId: String, navProperty: String, to: Option[String] = None): IO[Boolean]

    Disassociate an entity fram a navigation property.

  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def executeAction[A](action: String, body: Entity, entitySetAndId: Option[(String, String)] = None, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit d: EntityDecoder[IO, A]): IO[A]

    Execute an action.

    Execute an action. Can be bound or unbound depending on entityCollectionAndId. Action name may be prefixed with a namespace like Microsoft.Dynamics.CRM.

    TODO: Map into a http.expect.

  19. def executeFunction[A](function: String, parameters: Map[String, Any] = Map.empty, entity: Option[(String, String)] = None)(implicit d: EntityDecoder[IO, A]): IO[A]

    Exceute a bound or unbound function.

    Exceute a bound or unbound function.

    function

    Function name

    parameters

    Query parameters for function.

    entity

    Optional (entityCollection, id) info for bound function call. Use None for unbound function call.

    d

    Decode response body.

  20. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def findDynamicsError(body: Dynamic): Option[DynamicsErrorJS]

    Find an optional dynamics error message in the body.

    Find an optional dynamics error message in the body.

    Attributes
    protected
  22. def findSimpleMessage(body: Dynamic): Option[String]

    Not sure when this might apply.

    Not sure when this might apply. Do we get errors where the error property is embedded on a Message (capital?) field?

    Attributes
    protected
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def getList[A <: Any](url: String, opts: DynamicsOptions = DefaultDynamicsOptions)(): IO[Seq[A]]

    Get a list of values.

    Get a list of values. Follows @data.nextLink but accumulates all the results into memory. Prefer getListStream. For now, the caller must decode external to this method. The url is typically created from a QuerySpec.

    See also

    getListStream

  25. def getListStream[A <: Any](url: String, opts: DynamicsOptions = DefaultDynamicsOptions): Stream[IO, A]

    Get a list of values as a stream.

    Get a list of values as a stream. Follows @odata.nextLink. For now, the caller must decode external to this method. The url is usually created from a QuerySpec e.g. val q = QuerySpec(); val url = q.url("entitysetname").

  26. def getOne[A](url: String, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit d: EntityDecoder[IO, A]): IO[A]

    Get one entity using a full query url.

    Get one entity using a full query url. You can use a QuerySpec to form the url then call qs.url(myentities,Some(theid)).

    If you use a URL that returns a OData response with a value array that needs be automatically extracted, you need to use an explict EntityDecoder that first looks for that array then obtains your A. See EntityDecoder.ValueWrapper for an example.

    You also use this pattern when employing getOne to obtain related records in a 1:M navigation property e.g. a single entity's set of connections or some child entity. In this case, your URL will typically have an "expand" segment. Note that if you navigate to a simple attribute, then it is returned as a simple object also attached to "value" so choose your decoder wisely.

    To do

    Return an Option?

  27. def getOneWithKey[A](entitySet: String, keyInfo: DynamicsId, attributes: Seq[String] = Nil, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit d: EntityDecoder[IO, A]): IO[A]

    Get a single entity using key information.

    Get a single entity using key information. The keyInfo can be a guid or alternate key criteria e.g "altkeyattribute='Larry',...". You get all the fields with this. This assumes that the entity exists since you providing it in id--you should know ahead of time.

    Allow you to specify a queryspec somehow as well.

    To do

    Return an Option?

  28. val http: Client[IO]
    Definition Classes
    DynamicsClientClientMethods
  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. lazy val logger: Logger
    Definition Classes
    LazyLogger
  31. def mkAssociateRequest[F[_]](fromEntitySet: String, fromEntityId: String, navProperty: String, toEntitySet: String, toEntityId: String, base: String, singleValuedNavProperty: Boolean = true): HttpRequest[F]

    Not sure adding $base to the @odata.id is absolutely needed.

    Not sure adding $base to the @odata.id is absolutely needed. Probably is.

    Definition Classes
    DynamicsClientRequests
    See also

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/associate-disassociate-entities-using-web-api?view=dynamics-ce-odata-9

  32. def mkBatch[F[_]](m: Multipart, headers: HttpHeaders = HttpHeaders.empty): HttpRequest[F]

    Body in HttpRequest is ignored and is instead generated from m.

    Body in HttpRequest is ignored and is instead generated from m. Since the parts will have requests, you need to ensure that the base URL used in those requests have a consistent base URL.

    Definition Classes
    DynamicsClientRequests
  33. def mkBatchRequest[F[_], A](headers: HttpHeaders, m: Multipart): HttpRequest[F]

    Definition Classes
    DynamicsClientRequests
  34. def mkCreateRequest[F[_], B](entitySet: String, body: B, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit e: EntityEncoder[B]): HttpRequest[F]
    Definition Classes
    DynamicsClientRequests
  35. def mkDeleteRequest[F[_]](entitySet: String, keyInfo: DynamicsId, opts: DynamicsOptions = DefaultDynamicsOptions): HttpRequest[F]

    Make a pure delete request.

    Make a pure delete request.

    Definition Classes
    DynamicsClientRequests
  36. def mkDisassocatiateRequest[F[_]](fromEntitySet: String, fromEntityId: String, navProperty: String, toId: Option[String]): HttpRequest[F]

    Provide to if its a collection-valued navigation property, otherwise it removes a single-valued navigation property.

    Provide to if its a collection-valued navigation property, otherwise it removes a single-valued navigation property.

    Definition Classes
    DynamicsClientRequests
    See also

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/associate-disassociate-entities-using-web-api?view=dynamics-ce-odata-9

  37. def mkExecuteActionRequest[F[_]](action: String, body: Entity, entitySetAndId: Option[(String, String)] = None, opts: DynamicsOptions = DefaultDynamicsOptions): HttpRequest[F]
    Definition Classes
    DynamicsClientRequests
  38. def mkExecuteFunctionRequest[F[_]](function: String, parameters: Map[String, Any] = Map.empty, entity: Option[(String, String)] = None): HttpRequest[F]
    Definition Classes
    DynamicsClientRequests
  39. def mkGetListRequest[F[_]](url: String, opts: DynamicsOptions = DefaultDynamicsOptions): HttpRequest[F]
    Definition Classes
    DynamicsClientRequests
  40. def mkGetOneRequest[F[_]](url: String, opts: DynamicsOptions): HttpRequest[F]
    Definition Classes
    DynamicsClientRequests
  41. def mkUpdateRequest[F[_], B](entitySet: String, id: String, body: B, upsertPreventCreate: Boolean = true, upsertPreventUpdate: Boolean = false, options: DynamicsOptions = DefaultDynamicsOptions, base: Option[String] = None)(implicit enc: EntityEncoder[B]): HttpRequest[F]

    Create a PATCH request that could also upsert.

    Create a PATCH request that could also upsert. "opts" version could override upsertPreventCreate if a version value is also included, so be careful.

    Definition Classes
    DynamicsClientRequests
  42. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  43. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  44. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  45. def responseToFailedTask[A](resp: HttpResponse[IO], msg: String, req: Option[HttpRequest[IO]]): IO[A]

    Called in response to a bad status returned from a request.

    Called in response to a bad status returned from a request. Create a failed effect and pull out a dynamics server error message from the body, if present.

    Definition Classes
    DynamicsClientClientMethods
  46. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  47. def toHeaders(o: DynamicsOptions): HttpHeaders

    This does not handle the version tag + applyOptimisticConcurrency flag yet.

    This does not handle the version tag + applyOptimisticConcurrency flag yet.

    Definition Classes
    DynamicsClientRequests
  48. def update[B](entitySet: String, id: String, body: B, upsertPreventCreate: Boolean = true, upsertPreventUpdate: Boolean = false, opts: DynamicsOptions = DefaultDynamicsOptions)(implicit e: EntityEncoder[B]): IO[String]

    Update an entity.

    Update an entity. Fails if no odata-entityid is returned in the header. For now, do not use return=representation.

  49. def updateOneProperty(entitySet: String, id: String, property: String, value: Any, opts: DynamicsOptions = QuietDynamicsOptions): IO[String]

    Update a single property, return the id updated.

    Update a single property, return the id updated.

    See also

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/update-delete-entities-using-web-api?view=dynamics-ce-odata-9

  50. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Deprecated Value Members

  1. def batch[R](r: HttpRequest[IO], m: Multipart)(implicit e: EntityEncoder[Multipart], d: EntityDecoder[IO, R]): IO[R]

    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from ClientMethods

Inherited from DynamicsClientRequests

Inherited from LazyLogger

Inherited from AnyRef

Inherited from Any

Ungrouped