Last active
September 23, 2020 21:34
-
-
Save cmonacaps/0504de93ad6bf56c9177f2cf0b23efb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .../pharmakonRequests/index.js | |
export const getS2LOrder: (client: Client, pkReq: PKS2LOrderRequest) => Promise<PKS2LOrderResponse> | |
// Note this particular example is contrived, insofar as we know that `pkReq` is just an | |
// Order ID - | |
// * its type would just be `string | number`, not the fancy name used above | |
// * it doesn't need a (request-side) transformation - if it has it would just be `identity` | |
// function | |
// .../pharmakonS2LBAdapter/index.js | |
export const transformGetOrderDetailRequest: | |
(s2lbReq: S2LBGetOrderDetailRequest) => PKS2LOrderRequest | |
export const transformGetOrderDetailResponse: | |
(pkRes: PKS2LOrderResponse) => S2LBGetOrderDetailResponse) | |
// ... *hypothetical* code using this | |
import * as pharmakonRequests from './pharmakonRequests' | |
import * as pharmakonS2LBAdapter from './pharmakonS2LBAdapter' | |
const pkRes = await pharmakonRequests.getS2LOrder(client, pkReq) | |
const pkReq = pharmakonAdapter.transformGetOrderDetailRequest(s2lbReq) | |
const s2lbRes = pharmakonAdapter.transformGetOrderDetailResponse(pkRes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment