Skip to content

Instantly share code, notes, and snippets.

View jozefvaclavik's full-sized avatar

Jozef Vaclavik jozefvaclavik

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jozefvaclavik on github.
  • I am jozef (https://keybase.io/jozef) on keybase.
  • I have a public key ASCAQkaqRhfeAMCNy7vA5044p627tMfs2PqtVMdh6S0oAgo

To claim this, I am signing this object:

@jozefvaclavik
jozefvaclavik / LedgerSync_single-endpoint_multiple-payloads_RainforestExample.md
Last active March 4, 2022 18:28
LedgerSync - Single Endpoint, Multiple Resources - RainforestAPI Example

LedgerSync - Single endpoints with different types

Sometimes you have one endpoint that accepts different payloads with some type identifier. While you can pass Resource, Serializer and Deserializer to the Operation, the Operation tries to infer Resource class from its name.

There are two ways to solve this:

Dummy Resource

You create Operation for specific endpoint and dummy Resource with Serializer and Deserializer. Then you create Resource, Serializer and Deserializer for each type you have and you pass these into the Operation.