@oystehr/sdk 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +24 -8
  2. package/dist/cjs/client/client.d.ts +1 -1
  3. package/dist/cjs/config.d.ts +5 -0
  4. package/dist/cjs/errors/index.d.ts +4 -1
  5. package/dist/cjs/index.cjs +210 -97
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/index.min.cjs +1 -1
  8. package/dist/cjs/index.min.cjs.map +1 -1
  9. package/dist/cjs/resources/classes/application.d.ts +1 -0
  10. package/dist/cjs/resources/classes/charge.d.ts +1 -0
  11. package/dist/cjs/resources/classes/conversation.d.ts +1 -0
  12. package/dist/cjs/resources/classes/developer.d.ts +1 -0
  13. package/dist/cjs/resources/classes/erx.d.ts +1 -0
  14. package/dist/cjs/resources/classes/fax.d.ts +1 -0
  15. package/dist/cjs/resources/classes/fhir.d.ts +1 -0
  16. package/dist/cjs/resources/classes/index.d.ts +1 -1
  17. package/dist/cjs/resources/classes/m2m.d.ts +1 -0
  18. package/dist/cjs/resources/classes/messaging.d.ts +1 -0
  19. package/dist/cjs/resources/classes/paymentMethod.d.ts +1 -0
  20. package/dist/cjs/resources/classes/project.d.ts +1 -0
  21. package/dist/cjs/resources/classes/rcm.d.ts +1 -0
  22. package/dist/cjs/resources/classes/role.d.ts +1 -0
  23. package/dist/cjs/resources/classes/secret.d.ts +1 -0
  24. package/dist/cjs/resources/classes/telemed.d.ts +1 -0
  25. package/dist/cjs/resources/classes/transactionalSMS.d.ts +1 -0
  26. package/dist/cjs/resources/classes/user.d.ts +1 -0
  27. package/dist/cjs/resources/classes/version.d.ts +1 -0
  28. package/dist/cjs/resources/classes/z3.d.ts +1 -0
  29. package/dist/cjs/resources/classes/zambda.d.ts +1 -0
  30. package/dist/cjs/resources/classes/zambdaLogStream.d.ts +1 -0
  31. package/dist/cjs/resources/types/DeveloperInviteResponse.d.ts +0 -4
  32. package/dist/cjs/resources/types/index.d.ts +2 -2
  33. package/dist/cjs/tests/setup/constants.d.ts +2 -6
  34. package/dist/cjs/tests/setup/global.d.ts +1 -0
  35. package/dist/esm/client/client.d.ts +1 -1
  36. package/dist/esm/client/client.js +4 -4
  37. package/dist/esm/client/client.js.map +1 -1
  38. package/dist/esm/config.d.ts +5 -0
  39. package/dist/esm/errors/index.d.ts +4 -1
  40. package/dist/esm/errors/index.js +18 -2
  41. package/dist/esm/errors/index.js.map +1 -1
  42. package/dist/esm/index.min.js +1 -1
  43. package/dist/esm/index.min.js.map +1 -1
  44. package/dist/esm/resources/classes/application.d.ts +1 -0
  45. package/dist/esm/resources/classes/application.js +12 -8
  46. package/dist/esm/resources/classes/application.js.map +1 -1
  47. package/dist/esm/resources/classes/charge.d.ts +1 -0
  48. package/dist/esm/resources/classes/charge.js +6 -2
  49. package/dist/esm/resources/classes/charge.js.map +1 -1
  50. package/dist/esm/resources/classes/conversation.d.ts +1 -0
  51. package/dist/esm/resources/classes/conversation.js +9 -5
  52. package/dist/esm/resources/classes/conversation.js.map +1 -1
  53. package/dist/esm/resources/classes/developer.d.ts +1 -0
  54. package/dist/esm/resources/classes/developer.js +10 -6
  55. package/dist/esm/resources/classes/developer.js.map +1 -1
  56. package/dist/esm/resources/classes/erx.d.ts +1 -0
  57. package/dist/esm/resources/classes/erx.js +10 -6
  58. package/dist/esm/resources/classes/erx.js.map +1 -1
  59. package/dist/esm/resources/classes/fax.d.ts +1 -0
  60. package/dist/esm/resources/classes/fax.js +7 -3
  61. package/dist/esm/resources/classes/fax.js.map +1 -1
  62. package/dist/esm/resources/classes/fhir.d.ts +1 -0
  63. package/dist/esm/resources/classes/fhir.js +4 -0
  64. package/dist/esm/resources/classes/fhir.js.map +1 -1
  65. package/dist/esm/resources/classes/index.d.ts +1 -1
  66. package/dist/esm/resources/classes/index.js +6 -1
  67. package/dist/esm/resources/classes/index.js.map +1 -1
  68. package/dist/esm/resources/classes/m2m.d.ts +1 -0
  69. package/dist/esm/resources/classes/m2m.js +11 -7
  70. package/dist/esm/resources/classes/m2m.js.map +1 -1
  71. package/dist/esm/resources/classes/messaging.d.ts +1 -0
  72. package/dist/esm/resources/classes/messaging.js +5 -1
  73. package/dist/esm/resources/classes/messaging.js.map +1 -1
  74. package/dist/esm/resources/classes/paymentMethod.d.ts +1 -0
  75. package/dist/esm/resources/classes/paymentMethod.js +8 -4
  76. package/dist/esm/resources/classes/paymentMethod.js.map +1 -1
  77. package/dist/esm/resources/classes/project.d.ts +1 -0
  78. package/dist/esm/resources/classes/project.js +6 -2
  79. package/dist/esm/resources/classes/project.js.map +1 -1
  80. package/dist/esm/resources/classes/rcm.d.ts +1 -0
  81. package/dist/esm/resources/classes/rcm.js +7 -3
  82. package/dist/esm/resources/classes/rcm.js.map +1 -1
  83. package/dist/esm/resources/classes/role.d.ts +1 -0
  84. package/dist/esm/resources/classes/role.js +9 -5
  85. package/dist/esm/resources/classes/role.js.map +1 -1
  86. package/dist/esm/resources/classes/secret.d.ts +1 -0
  87. package/dist/esm/resources/classes/secret.js +8 -4
  88. package/dist/esm/resources/classes/secret.js.map +1 -1
  89. package/dist/esm/resources/classes/telemed.d.ts +1 -0
  90. package/dist/esm/resources/classes/telemed.js +6 -2
  91. package/dist/esm/resources/classes/telemed.js.map +1 -1
  92. package/dist/esm/resources/classes/transactionalSMS.d.ts +1 -0
  93. package/dist/esm/resources/classes/transactionalSMS.js +5 -1
  94. package/dist/esm/resources/classes/transactionalSMS.js.map +1 -1
  95. package/dist/esm/resources/classes/user.d.ts +1 -0
  96. package/dist/esm/resources/classes/user.js +11 -7
  97. package/dist/esm/resources/classes/user.js.map +1 -1
  98. package/dist/esm/resources/classes/version.d.ts +1 -0
  99. package/dist/esm/resources/classes/version.js +5 -1
  100. package/dist/esm/resources/classes/version.js.map +1 -1
  101. package/dist/esm/resources/classes/z3-ext.js +9 -5
  102. package/dist/esm/resources/classes/z3-ext.js.map +1 -1
  103. package/dist/esm/resources/classes/z3.d.ts +1 -0
  104. package/dist/esm/resources/classes/z3.js +10 -6
  105. package/dist/esm/resources/classes/z3.js.map +1 -1
  106. package/dist/esm/resources/classes/zambda-ext.js +5 -1
  107. package/dist/esm/resources/classes/zambda-ext.js.map +1 -1
  108. package/dist/esm/resources/classes/zambda.d.ts +1 -0
  109. package/dist/esm/resources/classes/zambda.js +12 -8
  110. package/dist/esm/resources/classes/zambda.js.map +1 -1
  111. package/dist/esm/resources/classes/zambdaLogStream.d.ts +1 -0
  112. package/dist/esm/resources/classes/zambdaLogStream.js +7 -3
  113. package/dist/esm/resources/classes/zambdaLogStream.js.map +1 -1
  114. package/dist/esm/resources/types/DeveloperInviteResponse.d.ts +0 -4
  115. package/dist/esm/resources/types/index.d.ts +2 -2
  116. package/dist/esm/tests/setup/constants.d.ts +2 -6
  117. package/dist/esm/tests/setup/global.d.ts +1 -0
  118. package/package.json +3 -3
  119. package/src/client/client.ts +6 -6
  120. package/src/config.ts +5 -0
  121. package/src/errors/index.ts +18 -2
  122. package/src/resources/classes/application.ts +15 -8
  123. package/src/resources/classes/charge.ts +5 -2
  124. package/src/resources/classes/conversation.ts +20 -5
  125. package/src/resources/classes/developer.ts +9 -6
  126. package/src/resources/classes/erx.ts +9 -6
  127. package/src/resources/classes/fax.ts +6 -3
  128. package/src/resources/classes/fhir.ts +3 -0
  129. package/src/resources/classes/index.ts +5 -2
  130. package/src/resources/classes/m2m.ts +10 -7
  131. package/src/resources/classes/messaging.ts +4 -1
  132. package/src/resources/classes/paymentMethod.ts +7 -4
  133. package/src/resources/classes/project.ts +5 -2
  134. package/src/resources/classes/rcm.ts +6 -3
  135. package/src/resources/classes/role.ts +8 -5
  136. package/src/resources/classes/secret.ts +7 -4
  137. package/src/resources/classes/telemed.ts +5 -2
  138. package/src/resources/classes/transactionalSMS.ts +4 -1
  139. package/src/resources/classes/user.ts +10 -7
  140. package/src/resources/classes/version.ts +4 -1
  141. package/src/resources/classes/z3-ext.ts +10 -4
  142. package/src/resources/classes/z3.ts +9 -6
  143. package/src/resources/classes/zambda-ext.ts +5 -1
  144. package/src/resources/classes/zambda.ts +11 -8
  145. package/src/resources/classes/zambdaLogStream.ts +10 -3
  146. package/src/resources/types/DeveloperInviteResponse.ts +0 -4
  147. package/src/resources/types/index.ts +2 -2
@@ -5,6 +5,10 @@ class ZambdaLogStream extends SDKResource {
5
5
  constructor(config) {
6
6
  super(config);
7
7
  }
8
+ baseUrlThunk() {
9
+ var _a, _b;
10
+ return (_b = (_a = this.config.services) === null || _a === void 0 ? void 0 : _a['projectApiUrl']) !== null && _b !== void 0 ? _b : 'https://project-api.zapehr.com/v1';
11
+ }
8
12
  /**
9
13
  * Get the log streams for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
10
14
  *
@@ -12,7 +16,7 @@ class ZambdaLogStream extends SDKResource {
12
16
  * Access Policy Resource: `Zambda:Function`
13
17
  */
14
18
  list(params, request) {
15
- return this.request('/zambda/{id}/logStream', 'post')(params, request);
19
+ return this.request('/zambda/{id}/logStream', 'post', this.baseUrlThunk.bind(this))(params, request);
16
20
  }
17
21
  /**
18
22
  * Get all logs for the Zambda Function with the provided ID, filtered by any of: text in messages, minimum start date, and/or maximum end date. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
@@ -21,7 +25,7 @@ class ZambdaLogStream extends SDKResource {
21
25
  * Access Policy Resource: `Zambda:Function`
22
26
  */
23
27
  search(params, request) {
24
- return this.request('/zambda/{id}/logStream/search', 'post')(params, request);
28
+ return this.request('/zambda/{id}/logStream/search', 'post', this.baseUrlThunk.bind(this))(params, request);
25
29
  }
26
30
  /**
27
31
  * Get the logs from the specified log stream for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
@@ -30,7 +34,7 @@ class ZambdaLogStream extends SDKResource {
30
34
  * Access Policy Resource: `Zambda:Function`
31
35
  */
32
36
  get(params, request) {
33
- return this.request('/zambda/{id}/logStream/{logStreamName}', 'post')(params, request);
37
+ return this.request('/zambda/{id}/logStream/{logStreamName}', 'post', this.baseUrlThunk.bind(this))(params, request);
34
38
  }
35
39
  }
36
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"zambdaLogStream.js","sources":["../../../../src/resources/classes/zambdaLogStream.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n OystehrClientRequest,\n ZambdaLogStreamGetParams,\n ZambdaLogStreamGetResponse,\n ZambdaLogStreamListParams,\n ZambdaLogStreamListResponse,\n ZambdaLogStreamSearchParams,\n ZambdaLogStreamSearchResponse,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class ZambdaLogStream extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n /**\n * Get the log streams for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n list(params: ZambdaLogStreamListParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamListResponse> {\n return this.request('/zambda/{id}/logStream', 'post')(params, request);\n }\n /**\n * Get all logs for the Zambda Function with the provided ID, filtered by any of: text in messages, minimum start date, and/or maximum end date. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n search(params: ZambdaLogStreamSearchParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamSearchResponse> {\n return this.request('/zambda/{id}/logStream/search', 'post')(params, request);\n }\n /**\n * Get the logs from the specified log stream for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n get(params: ZambdaLogStreamGetParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamGetResponse> {\n return this.request('/zambda/{id}/logStream/{logStreamName}', 'post')(params, request);\n }\n}\n"],"names":[],"mappings":";;AAAA;AAcM,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAC9C,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;AACD;;;;;AAKG;IACH,IAAI,CAAC,MAAiC,EAAE,OAA8B,EAAA;AACpE,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACxE;AACD;;;;;AAKG;IACH,MAAM,CAAC,MAAmC,EAAE,OAA8B,EAAA;AACxE,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/E;AACD;;;;;AAKG;IACH,GAAG,CAAC,MAAgC,EAAE,OAA8B,EAAA;AAClE,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,wCAAwC,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACxF;AACF;;;;"}
1
+ {"version":3,"file":"zambdaLogStream.js","sources":["../../../../src/resources/classes/zambdaLogStream.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n OystehrClientRequest,\n ZambdaLogStreamGetParams,\n ZambdaLogStreamGetResponse,\n ZambdaLogStreamListParams,\n ZambdaLogStreamListResponse,\n ZambdaLogStreamSearchParams,\n ZambdaLogStreamSearchResponse,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class ZambdaLogStream extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n baseUrlThunk(): string {\n return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';\n }\n /**\n * Get the log streams for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n list(params: ZambdaLogStreamListParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamListResponse> {\n return this.request('/zambda/{id}/logStream', 'post', this.baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get all logs for the Zambda Function with the provided ID, filtered by any of: text in messages, minimum start date, and/or maximum end date. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n search(params: ZambdaLogStreamSearchParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamSearchResponse> {\n return this.request('/zambda/{id}/logStream/search', 'post', this.baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get the logs from the specified log stream for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.\n *\n * Access Policy Action: `Zambda:ReadLogs`\n * Access Policy Resource: `Zambda:Function`\n */\n get(params: ZambdaLogStreamGetParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamGetResponse> {\n return this.request(\n '/zambda/{id}/logStream/{logStreamName}',\n 'post',\n this.baseUrlThunk.bind(this)\n )(params, request);\n }\n}\n"],"names":[],"mappings":";;AAAA;AAcM,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAC9C,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;IACD,YAAY,GAAA;;AACV,QAAA,OAAO,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,eAAe,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,mCAAmC,CAAC;KACvF;AACD;;;;;AAKG;IACH,IAAI,CAAC,MAAiC,EAAE,OAA8B,EAAA;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtG;AACD;;;;;AAKG;IACH,MAAM,CAAC,MAAmC,EAAE,OAA8B,EAAA;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC7G;AACD;;;;;AAKG;IACH,GAAG,CAAC,MAAgC,EAAE,OAA8B,EAAA;QAClE,OAAO,IAAI,CAAC,OAAO,CACjB,wCAAwC,EACxC,MAAM,EACN,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpB;AACF;;;;"}
@@ -12,10 +12,6 @@ export interface DeveloperInviteResponse {
12
12
  * The ID of the FHIR Practitioner resource that represents the developer. Also known as the Developer's "profile".
13
13
  */
14
14
  practitionerId: string;
15
- /**
16
- * The ID of the invite
17
- */
18
- invitationUrl: string;
19
15
  /**
20
16
  * The roles assigned to the developer.
21
17
  */
@@ -103,8 +103,6 @@ export * from './ErxMedicationSearchParams';
103
103
  export * from './ErxMedicationSearchResponse';
104
104
  export * from './ErxMedicationSearchV2Params';
105
105
  export * from './ErxMedicationSearchV2Response';
106
- export * from './FaxSendParams';
107
- export * from './FaxSendResponse';
108
106
  export * from './RoleListResponse';
109
107
  export * from './RoleCreateParams';
110
108
  export * from './RoleCreateResponse';
@@ -164,3 +162,5 @@ export * from './ZambdaLogStreamSearchParams';
164
162
  export * from './ZambdaLogStreamSearchResponse';
165
163
  export * from './ZambdaLogStreamGetParams';
166
164
  export * from './ZambdaLogStreamGetResponse';
165
+ export * from './FaxSendParams';
166
+ export * from './FaxSendResponse';
@@ -1,12 +1,8 @@
1
+ import { OystehrConfig } from '../../config';
1
2
  export declare const accessToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IllhcGtmeERqb3FvVnR1YUtlcHllZyJ9.eyJpc3MiOiJodHRwczovL2Rldi1hdXRoLnphcGVoci5jb20vIiwic3ViIjoiYXV0aDB8NjQ4MjRmYTYxODY2YmVmY2NiNTU5NTY4IiwiYXVkIjpbImh0dHBzOi8vZGV2LmFwaS56YXBlaHIuY29tIiwiaHR0cHM6Ly96YXBlaHItZGV2LnVzLmF1dGgwLmNvbS91c2VyaW5mbyJdLCJpYXQiOjE2ODYyNjE2NzIsImV4cCI6MTY4NjM0ODA3MiwiYXpwIjoiZzNPV0xIb1dhUEhHWkRyd1lTYW5QdDBCcUp6ZXgzTnYiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIn0.EBSaOYp5NMJ94GZyd9cg57QWnozlN-ua4XAO3iIrPal16yWOW-_TeVgj-1j-PwAhHaxW8QoTuojMXwhWVkNUwUw1AomxFubrvL98jm871VMZTXayQRGGlZHUsREmUDWpojGKAf0wAegEPC-kSw5KAc79V5SOrcVzhTmk5AMnR1aDzck9ZbXpTCPWWmyjyf4BiCb4N3zw3Zt3iQ0c5YDKvdMa_aAKiUZ9jaOw1TnQZ4tivKsn2uVfRGPZ5WFmj7B2MQTpzw4rokHtnSYtbKb-1h5wMxsdmzy_gKMYYaiPGqkJVt1twtjH9O1nZZMSDjGQI5B96TnrVjBFm6ow8jpBKg";
2
3
  export declare const projectId = "eb1306aa-fba5-416a-a2a4-6b69eca58d87";
3
4
  export declare const FHIR_API_URL = "http://localhost:3030/dev";
4
5
  export declare const PLATFORM_API_URL = "http://localhost:3031/dev";
5
6
  export declare const PROJECT_API_URL = "http://localhost:3032/dev";
6
7
  export declare const FHIR_VERSION: import("@zapehr/core").FhirVersion;
7
- export declare const config: {
8
- accessToken: string;
9
- projectId: string;
10
- fhirApiUrl: string;
11
- projectApiUrl: string;
12
- };
8
+ export declare const config: OystehrConfig;
@@ -1 +1,2 @@
1
+ export declare function register(authToken: string, desiredProjectId?: string): Promise<string>;
1
2
  export default function registerUserAndProject(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oystehr/sdk",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "Oystehr SDK",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
@@ -14,7 +14,7 @@
14
14
  "parser": "ts-node debug-parser.ts",
15
15
  "publish-to-npmjs": "npm run build && npm publish",
16
16
  "publish-to-npmjs-next": "npm run build && npm publish --tag next",
17
- "generate": "ts-node scripts/generate-sdk-v3 project src/resources"
17
+ "generate": "ts-node scripts/generate-sdk-v3 project,fax src/resources"
18
18
  },
19
19
  "engines": {
20
20
  "npm": ">=8.0.0",
@@ -56,4 +56,4 @@
56
56
  "stu3",
57
57
  "hl7"
58
58
  ]
59
- }
59
+ }
@@ -55,15 +55,14 @@ export class SDKResource {
55
55
  this.config = config;
56
56
  }
57
57
 
58
- protected request(path: string, method: string): FetcherFunction {
58
+ protected request(path: string, method: string, baseUrlThunk: () => string): FetcherFunction {
59
59
  return async (params: any, request?: InternalClientRequest): Promise<FetcherResponse> => {
60
- const baseUrlThunk = (): string => this.config.projectApiUrl ?? defaultProjectApiUrl;
61
60
  const configThunk = (): OystehrConfig => this.config;
62
61
  try {
63
62
  return await fetcher(baseUrlThunk, configThunk, path, method)(params, request);
64
63
  } catch (err: any) {
65
- const error = err as { message: string; code: number };
66
- throw new OystehrSdkError({ message: error.message, code: error.code });
64
+ const error = err as { message: string; code: number; cause?: unknown };
65
+ throw new OystehrSdkError({ message: error.message, code: error.code, cause: error.cause });
67
66
  }
68
67
  };
69
68
  }
@@ -71,17 +70,18 @@ export class SDKResource {
71
70
  protected fhirRequest<T extends FhirResource = any>(path: string, method: string) {
72
71
  return async (params: any, request?: InternalClientRequest): Promise<FhirFetcherResponse<T>> => {
73
72
  try {
74
- const baseUrlThunk = (): string => this.config.fhirApiUrl ?? defaultFhirApiUrl;
73
+ const baseUrlThunk = (): string => this.config.services?.fhirApiUrl ?? defaultFhirApiUrl;
75
74
  const configThunk = (): OystehrConfig => this.config;
76
75
  // must await here to catch
77
76
  return await fetcher(baseUrlThunk, configThunk, path, method)(params, request);
78
77
  } catch (err: unknown) {
79
78
  // FHIR API error messages are JSON strings
80
- const fullError = err as { message: string | Record<string, any>; code: number };
79
+ const fullError = err as { message: string | Record<string, any>; code: number; cause?: unknown };
81
80
  if (typeof fullError.message === 'string') {
82
81
  throw new OystehrSdkError({
83
82
  message: fullError.message,
84
83
  code: fullError.code,
84
+ cause: fullError.cause,
85
85
  });
86
86
  }
87
87
  throw new OystehrFHIRError({
package/src/config.ts CHANGED
@@ -12,6 +12,11 @@ export interface OystehrConfig {
12
12
  projectId?: string;
13
13
  fhirApiUrl?: string;
14
14
  projectApiUrl?: string;
15
+ services?: {
16
+ faxApiUrl?: string;
17
+ fhirApiUrl?: string;
18
+ projectApiUrl?: string;
19
+ };
15
20
  /**
16
21
  * Optionally provide a custom fetch implementation. This must conform to the
17
22
  * built-in node.js fetch implementation (undici fetch).
@@ -3,8 +3,8 @@ import { OperationOutcome as OperationOutcomeR5 } from 'fhir/r5';
3
3
 
4
4
  export class OystehrSdkError extends Error {
5
5
  code: number;
6
- constructor({ message, code }: { message: string; code: number }) {
7
- super(message);
6
+ constructor({ message, code, cause }: { message: string; code: number; cause?: unknown }) {
7
+ super(message, { cause });
8
8
  Object.setPrototypeOf(this, OystehrSdkError.prototype);
9
9
  this.code = code;
10
10
  this.name = 'OystehrSdkError';
@@ -12,6 +12,14 @@ export class OystehrSdkError extends Error {
12
12
  toString(): string {
13
13
  return `${this.name}: ${this.message} (code: ${this.code})`;
14
14
  }
15
+ toJSON(): any {
16
+ return {
17
+ name: this.name,
18
+ message: this.message,
19
+ code: this.code,
20
+ cause: this.cause,
21
+ };
22
+ }
15
23
  }
16
24
 
17
25
  function transformOperationOutcomeToErrorMessage(cause: OperationOutcomeR4B | OperationOutcomeR5): string {
@@ -38,4 +46,12 @@ export class OystehrFHIRError extends OystehrSdkError {
38
46
  this.cause = error as OperationOutcomeR4B | OperationOutcomeR5;
39
47
  this.name = 'OystehrFHIRError';
40
48
  }
49
+ toJSON(): any {
50
+ return {
51
+ name: this.name,
52
+ message: this.message,
53
+ code: this.code,
54
+ cause: this.cause,
55
+ };
56
+ }
41
57
  }
@@ -24,6 +24,9 @@ export class Application extends SDKResource {
24
24
  constructor(config: OystehrConfig) {
25
25
  super(config);
26
26
  }
27
+ baseUrlThunk(): string {
28
+ return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
29
+ }
27
30
  /**
28
31
  * Get a list of Applications. [Applications](https://docs.oystehr.com/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
29
32
  *
@@ -31,7 +34,7 @@ export class Application extends SDKResource {
31
34
  * Access Policy Resource: `App:Application`
32
35
  */
33
36
  list(request?: OystehrClientRequest): Promise<ApplicationListResponse> {
34
- return this.request('/application', 'get')(request);
37
+ return this.request('/application', 'get', this.baseUrlThunk.bind(this))(request);
35
38
  }
36
39
  /**
37
40
  * Create a new Application. [Applications](https://docs.oystehr.com/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
@@ -40,7 +43,7 @@ export class Application extends SDKResource {
40
43
  * Access Policy Resource: `App:Application`
41
44
  */
42
45
  create(params: ApplicationCreateParams, request?: OystehrClientRequest): Promise<ApplicationCreateResponse> {
43
- return this.request('/application', 'post')(params, request);
46
+ return this.request('/application', 'post', this.baseUrlThunk.bind(this))(params, request);
44
47
  }
45
48
  /**
46
49
  * Get the Application with the provided ID. [Applications](https://docs.oystehr.com/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
@@ -49,7 +52,7 @@ export class Application extends SDKResource {
49
52
  * Access Policy Resource: `App:Application`
50
53
  */
51
54
  get(params: ApplicationGetParams, request?: OystehrClientRequest): Promise<ApplicationGetResponse> {
52
- return this.request('/application/{id}', 'get')(params, request);
55
+ return this.request('/application/{id}', 'get', this.baseUrlThunk.bind(this))(params, request);
53
56
  }
54
57
  /**
55
58
  * Update the Application with the provided ID. [Applications](https://docs.oystehr.com/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
@@ -58,7 +61,7 @@ export class Application extends SDKResource {
58
61
  * Access Policy Resource: `App:Application`
59
62
  */
60
63
  update(params: ApplicationUpdateParams, request?: OystehrClientRequest): Promise<ApplicationUpdateResponse> {
61
- return this.request('/application/{id}', 'patch')(params, request);
64
+ return this.request('/application/{id}', 'patch', this.baseUrlThunk.bind(this))(params, request);
62
65
  }
63
66
  /**
64
67
  * Delete the Application with the provided ID. [Applications](https://docs.oystehr.com/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
@@ -67,7 +70,7 @@ export class Application extends SDKResource {
67
70
  * Access Policy Resource: `App:Application`
68
71
  */
69
72
  delete(params: ApplicationDeleteParams, request?: OystehrClientRequest): Promise<void> {
70
- return this.request('/application/{id}', 'delete')(params, request);
73
+ return this.request('/application/{id}', 'delete', this.baseUrlThunk.bind(this))(params, request);
71
74
  }
72
75
  /**
73
76
  * Rotate client's secrete associated with an application.
@@ -79,7 +82,7 @@ export class Application extends SDKResource {
79
82
  params: ApplicationRotateSecretParams,
80
83
  request?: OystehrClientRequest
81
84
  ): Promise<ApplicationRotateSecretResponse> {
82
- return this.request('/application/{id}/rotate-secret', 'post')(params, request);
85
+ return this.request('/application/{id}/rotate-secret', 'post', this.baseUrlThunk.bind(this))(params, request);
83
86
  }
84
87
  /**
85
88
  * Revokes user's refresh token issued for the application.
@@ -91,7 +94,11 @@ export class Application extends SDKResource {
91
94
  params: ApplicationRevokeRefreshTokenParams,
92
95
  request?: OystehrClientRequest
93
96
  ): Promise<ApplicationRevokeRefreshTokenResponse> {
94
- return this.request('/application/{id}/revoke-refresh-token', 'post')(params, request);
97
+ return this.request(
98
+ '/application/{id}/revoke-refresh-token',
99
+ 'post',
100
+ this.baseUrlThunk.bind(this)
101
+ )(params, request);
95
102
  }
96
103
  /**
97
104
  * Revokes user's access token issued for the application.
@@ -103,6 +110,6 @@ export class Application extends SDKResource {
103
110
  params: ApplicationRevokeAccessTokenParams,
104
111
  request?: OystehrClientRequest
105
112
  ): Promise<ApplicationRevokeAccessTokenResponse> {
106
- return this.request('/application/{id}/revoke-access-token', 'post')(params, request);
113
+ return this.request('/application/{id}/revoke-access-token', 'post', this.baseUrlThunk.bind(this))(params, request);
107
114
  }
108
115
  }
@@ -8,6 +8,9 @@ export class Charge extends SDKResource {
8
8
  constructor(config: OystehrConfig) {
9
9
  super(config);
10
10
  }
11
+ baseUrlThunk(): string {
12
+ return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
13
+ }
11
14
  /**
12
15
  * Charge patient's default payment method for a specified encounter or charge item.
13
16
  *
@@ -20,7 +23,7 @@ export class Charge extends SDKResource {
20
23
  * Access Policy Resources: `FHIR:Patient:*,FHIR:Encounter:*,FHIR:Coverage:*`
21
24
  */
22
25
  issue(params: ChargeIssueParams, request?: OystehrClientRequest): Promise<void> {
23
- return this.request('/payment/charge/issue', 'post')(params, request);
26
+ return this.request('/payment/charge/issue', 'post', this.baseUrlThunk.bind(this))(params, request);
24
27
  }
25
28
  /**
26
29
  * Retrieve charge status for a specified encounter or charge item.
@@ -34,6 +37,6 @@ export class Charge extends SDKResource {
34
37
  * Access Policy Resources: `FHIR:Patient:*,FHIR:Encounter:*,FHIR:Coverage:*`
35
38
  */
36
39
  status(params: ChargeStatusParams, request?: OystehrClientRequest): Promise<ChargeStatusResponse> {
37
- return this.request('/payment/charge/status', 'post')(params, request);
40
+ return this.request('/payment/charge/status', 'post', this.baseUrlThunk.bind(this))(params, request);
38
41
  }
39
42
  }
@@ -17,6 +17,9 @@ export class Conversation extends SDKResource {
17
17
  constructor(config: OystehrConfig) {
18
18
  super(config);
19
19
  }
20
+ baseUrlThunk(): string {
21
+ return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
22
+ }
20
23
  ENCOUNTER_VS_EXTENSION_URL = ext.ENCOUNTER_VS_EXTENSION_URL;
21
24
  ENCOUNTER_VS_EXTENSION_RELATIVE_URL = ext.ENCOUNTER_VS_EXTENSION_RELATIVE_URL;
22
25
  /**
@@ -37,7 +40,7 @@ export class Conversation extends SDKResource {
37
40
  * Access Policy Resource: `FHIR:Encounter`
38
41
  */
39
42
  create(params: ConversationCreateParams, request?: OystehrClientRequest): Promise<ConversationCreateResponse> {
40
- return this.request('/messaging/conversation', 'post')(params, request);
43
+ return this.request('/messaging/conversation', 'post', this.baseUrlThunk.bind(this))(params, request);
41
44
  }
42
45
  /**
43
46
  * Get a Conversation Token. Conversation Tokens are used to join the Conversation with the Twilio Conversations SDKs. [Conversations](https://docs.oystehr.com/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
@@ -46,7 +49,7 @@ export class Conversation extends SDKResource {
46
49
  * Access Policy Resource: `Messaging:Conversation`.
47
50
  */
48
51
  getToken(request?: OystehrClientRequest): Promise<ConversationGetTokenResponse> {
49
- return this.request('/messaging/conversation/token', 'get')(request);
52
+ return this.request('/messaging/conversation/token', 'get', this.baseUrlThunk.bind(this))(request);
50
53
  }
51
54
  /**
52
55
  * Add a participant to a Conversation. [Conversations](https://docs.oystehr.com/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
@@ -60,7 +63,11 @@ export class Conversation extends SDKResource {
60
63
  * Access Policy Resource: `FHIR:Encounter`
61
64
  */
62
65
  addParticipant(params: ConversationAddParticipantParams, request?: OystehrClientRequest): Promise<void> {
63
- return this.request('/messaging/conversation/{conversationId}/participant', 'post')(params, request);
66
+ return this.request(
67
+ '/messaging/conversation/{conversationId}/participant',
68
+ 'post',
69
+ this.baseUrlThunk.bind(this)
70
+ )(params, request);
64
71
  }
65
72
  /**
66
73
  * Remove a participant from a Conversation. [Conversations](https://docs.oystehr.com/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
@@ -72,7 +79,11 @@ export class Conversation extends SDKResource {
72
79
  * Access Policy Resource: `FHIR:Patient`, `FHIR:Practitioner`, or `FHIR:RelatedPerson`
73
80
  */
74
81
  removeParticipant(params: ConversationRemoveParticipantParams, request?: OystehrClientRequest): Promise<void> {
75
- return this.request('/messaging/conversation/{conversationId}/participant', 'delete')(params, request);
82
+ return this.request(
83
+ '/messaging/conversation/{conversationId}/participant',
84
+ 'delete',
85
+ this.baseUrlThunk.bind(this)
86
+ )(params, request);
76
87
  }
77
88
  /**
78
89
  * Send a message to a Conversation. [Conversations](https://docs.oystehr.com/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
@@ -82,6 +93,10 @@ export class Conversation extends SDKResource {
82
93
  * Access Policy Resource: `Messaging:Conversation`
83
94
  */
84
95
  message(params: ConversationMessageParams, request?: OystehrClientRequest): Promise<void> {
85
- return this.request('/messaging/conversation/{conversationId}/message', 'post')(params, request);
96
+ return this.request(
97
+ '/messaging/conversation/{conversationId}/message',
98
+ 'post',
99
+ this.baseUrlThunk.bind(this)
100
+ )(params, request);
86
101
  }
87
102
  }
@@ -20,6 +20,9 @@ export class Developer extends SDKResource {
20
20
  constructor(config: OystehrConfig) {
21
21
  super(config);
22
22
  }
23
+ baseUrlThunk(): string {
24
+ return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
25
+ }
23
26
  /**
24
27
  * Get the Developer with the provided ID. Developer accounts are used to log into the [Developer Console](https://console.oystehr.com/) and administrate [Projects](https://docs.oystehr.com/services/project/). [Developers](https://docs.oystehr.com/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
25
28
  *
@@ -27,7 +30,7 @@ export class Developer extends SDKResource {
27
30
  * Access Policy Resource: `IAM:Developer`
28
31
  */
29
32
  get(params: DeveloperGetParams, request?: OystehrClientRequest): Promise<DeveloperGetResponse> {
30
- return this.request('/developer/{id}', 'get')(params, request);
33
+ return this.request('/developer/{id}', 'get', this.baseUrlThunk.bind(this))(params, request);
31
34
  }
32
35
  /**
33
36
  * Update the Developer with the provided ID. Developer accounts are used to log into the [Developer Console](https://console.oystehr.com/) and administrate [Projects](https://docs.oystehr.com/services/project/). [Developers](https://docs.oystehr.com/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
@@ -36,7 +39,7 @@ export class Developer extends SDKResource {
36
39
  * Access Policy Resource: `IAM:Developer`
37
40
  */
38
41
  update(params: DeveloperUpdateParams, request?: OystehrClientRequest): Promise<DeveloperUpdateResponse> {
39
- return this.request('/developer/{id}', 'patch')(params, request);
42
+ return this.request('/developer/{id}', 'patch', this.baseUrlThunk.bind(this))(params, request);
40
43
  }
41
44
  /**
42
45
  * Remove the Developer with the provided ID from the project. Developer accounts are used to log into the [Developer Console](https://console.oystehr.com/) and administrate [Projects](https://docs.oystehr.com/services/project/). [Developers](https://docs.oystehr.com/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
@@ -45,7 +48,7 @@ export class Developer extends SDKResource {
45
48
  * Access Policy Resource: `IAM:Developer`
46
49
  */
47
50
  delete(params: DeveloperDeleteParams, request?: OystehrClientRequest): Promise<void> {
48
- return this.request('/developer/{id}', 'delete')(params, request);
51
+ return this.request('/developer/{id}', 'delete', this.baseUrlThunk.bind(this))(params, request);
49
52
  }
50
53
  /**
51
54
  * Invite a new Developer to the Project. Developer accounts are used to log into the [Developer Console](https://console.oystehr.com/) and administrate [Projects](https://docs.oystehr.com/services/project/). [Developers](https://docs.oystehr.com/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
@@ -54,7 +57,7 @@ export class Developer extends SDKResource {
54
57
  * Access Policy Resource: `IAM:Developer`
55
58
  */
56
59
  invite(params: DeveloperInviteParams, request?: OystehrClientRequest): Promise<DeveloperInviteResponse> {
57
- return this.request('/developer/invite', 'post')(params, request);
60
+ return this.request('/developer/invite', 'post', this.baseUrlThunk.bind(this))(params, request);
58
61
  }
59
62
  /**
60
63
  * DEPRECATED. Please use [v2/list](https://api-reference.oystehr.com/reference/get_developer-v2-list) instead.
@@ -65,7 +68,7 @@ export class Developer extends SDKResource {
65
68
  * Access Policy Resource: `IAM:Developer`
66
69
  */
67
70
  list(request?: OystehrClientRequest): Promise<DeveloperListResponse> {
68
- return this.request('/developer', 'get')(request);
71
+ return this.request('/developer', 'get', this.baseUrlThunk.bind(this))(request);
69
72
  }
70
73
  /**
71
74
  * Get Developers in the Project with pagination, sort, sort Order and filtering. [Users](https://docs.oystehr.com/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/services/app/applications/) you configure for securing the apps you build on top of Oystehr.
@@ -74,6 +77,6 @@ export class Developer extends SDKResource {
74
77
  * Access Policy Resource: `Project:Settings`
75
78
  */
76
79
  listV2(params: DeveloperListV2Params, request?: OystehrClientRequest): Promise<DeveloperListV2Response> {
77
- return this.request('/developer/v2/list', 'get')(params, request);
80
+ return this.request('/developer/v2/list', 'get', this.baseUrlThunk.bind(this))(params, request);
78
81
  }
79
82
  }
@@ -22,23 +22,26 @@ export class Erx extends SDKResource {
22
22
  constructor(config: OystehrConfig) {
23
23
  super(config);
24
24
  }
25
+ baseUrlThunk(): string {
26
+ return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
27
+ }
25
28
  /**
26
29
  * Retrieve patient properties from FHIR service and sync them with eRx service
27
30
  */
28
31
  syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<ErxSyncPatientResponse> {
29
- return this.request('/erx/sync-patient/{patientId}', 'post')(params, request);
32
+ return this.request('/erx/sync-patient/{patientId}', 'post', this.baseUrlThunk.bind(this))(params, request);
30
33
  }
31
34
  /**
32
35
  * Search for allergies
33
36
  */
34
37
  allergySearch(params: ErxAllergySearchParams, request?: OystehrClientRequest): Promise<ErxAllergySearchResponse> {
35
- return this.request('/erx/allergy/search', 'get')(params, request);
38
+ return this.request('/erx/allergy/search', 'get', this.baseUrlThunk.bind(this))(params, request);
36
39
  }
37
40
  /**
38
41
  * Cancel photon order
39
42
  */
40
43
  cancelOrder(params: ErxCancelOrderParams, request?: OystehrClientRequest): Promise<ErxCancelOrderResponse> {
41
- return this.request('/erx/cancel-order', 'post')(params, request);
44
+ return this.request('/erx/cancel-order', 'post', this.baseUrlThunk.bind(this))(params, request);
42
45
  }
43
46
  /**
44
47
  * Cancel photon prescription
@@ -47,7 +50,7 @@ export class Erx extends SDKResource {
47
50
  params: ErxCancelPrescriptionParams,
48
51
  request?: OystehrClientRequest
49
52
  ): Promise<ErxCancelPrescriptionResponse> {
50
- return this.request('/erx/cancel-prescription', 'post')(params, request);
53
+ return this.request('/erx/cancel-prescription', 'post', this.baseUrlThunk.bind(this))(params, request);
51
54
  }
52
55
  /**
53
56
  * Search for medications. Provide at least one of code or name filters
@@ -56,7 +59,7 @@ export class Erx extends SDKResource {
56
59
  params: ErxMedicationSearchParams,
57
60
  request?: OystehrClientRequest
58
61
  ): Promise<ErxMedicationSearchResponse> {
59
- return this.request('/erx/medication/search', 'get')(params, request);
62
+ return this.request('/erx/medication/search', 'get', this.baseUrlThunk.bind(this))(params, request);
60
63
  }
61
64
  /**
62
65
  * Search for medications. Provide at least one of code or name filters
@@ -65,6 +68,6 @@ export class Erx extends SDKResource {
65
68
  params: ErxMedicationSearchV2Params,
66
69
  request?: OystehrClientRequest
67
70
  ): Promise<ErxMedicationSearchV2Response> {
68
- return this.request('/erx/v2/medication/search', 'get')(params, request);
71
+ return this.request('/erx/v2/medication/search', 'get', this.baseUrlThunk.bind(this))(params, request);
69
72
  }
70
73
  }
@@ -8,6 +8,9 @@ export class Fax extends SDKResource {
8
8
  constructor(config: OystehrConfig) {
9
9
  super(config);
10
10
  }
11
+ baseUrlThunk(): string {
12
+ return this.config.services?.['faxApiUrl'] ?? 'https://fax-api.zapehr.com/v1';
13
+ }
11
14
  /**
12
15
  * Offboard a fax number. Oystehr's [offboard](https://docs.oystehr.com/services/fax/number/) feature makes it easy to stop using the fax service and release the project's assigned fax number with a single API call. Please note there is no way to guarantee getting the same number back again, so if you think this can break your project in any way we recommend not offboarding and avoid sending faxes until you're sure.
13
16
  *
@@ -16,7 +19,7 @@ export class Fax extends SDKResource {
16
19
  * Access Policy Resource: `Fax:Number`
17
20
  */
18
21
  offboard(request?: OystehrClientRequest): Promise<void> {
19
- return this.request('/fax/offboard', 'post')(request);
22
+ return this.request('/offboard', 'post', this.baseUrlThunk.bind(this))(request);
20
23
  }
21
24
  /**
22
25
  * Onboard a fax number. Oystehr's [onboard](https://docs.oystehr.com/services/fax/number/) feature makes it easy to start using the fax service and purchase a new fax number for your project with a single API call.
@@ -26,7 +29,7 @@ export class Fax extends SDKResource {
26
29
  * Access Policy Resource: `Fax:Number`
27
30
  */
28
31
  onboard(request?: OystehrClientRequest): Promise<void> {
29
- return this.request('/fax/onboard', 'post')(request);
32
+ return this.request('/onboard', 'post', this.baseUrlThunk.bind(this))(request);
30
33
  }
31
34
  /**
32
35
  * Send a fax. Oystehr's [fax sending](https://docs.oystehr.com/services/fax/send/) feature makes it easy to send a fax to a chosen recipient with a single API call. You can use this feature to send referrals, medical records, prescriptions, and other documents that require fax transmission e.g. for HIPAA compliance.
@@ -36,6 +39,6 @@ export class Fax extends SDKResource {
36
39
  * Access Policy Resource: `Fax:Fax`
37
40
  */
38
41
  send(params: FaxSendParams, request?: OystehrClientRequest): Promise<FaxSendResponse> {
39
- return this.request('/fax/send', 'post')(params, request);
42
+ return this.request('/send', 'post', this.baseUrlThunk.bind(this))(params, request);
40
43
  }
41
44
  }
@@ -8,6 +8,9 @@ export class Fhir extends SDKResource {
8
8
  constructor(config: OystehrConfig) {
9
9
  super(config);
10
10
  }
11
+ baseUrlThunk(): string {
12
+ return this.config.services?.['fhirApiUrl'] ?? 'https://fhir-api.zapehr.com';
13
+ }
11
14
  /**
12
15
  * Performs a FHIR search and returns the results as a Bundle resource
13
16
  * @param options FHIR resource type and FHIR search parameters
@@ -36,7 +36,6 @@ export class Oystehr {
36
36
  readonly project: Project;
37
37
  readonly rcm: Rcm;
38
38
  readonly erx: Erx;
39
- readonly fax: Fax;
40
39
  readonly role: Role;
41
40
  readonly secret: Secret;
42
41
  readonly telemed: Telemed;
@@ -45,9 +44,13 @@ export class Oystehr {
45
44
  readonly z3: Z3;
46
45
  readonly zambda: Zambda;
47
46
  readonly zambdaLogStream: ZambdaLogStream;
47
+ readonly fax: Fax;
48
48
  readonly fhir: Fhir;
49
49
  constructor(config: OystehrConfig) {
50
50
  this.config = config;
51
+ this.config.services ??= {};
52
+ this.config.services.projectApiUrl ??= config.projectApiUrl;
53
+ this.config.services.fhirApiUrl ??= config.fhirApiUrl;
51
54
  this.application = new Application(config);
52
55
  this.developer = new Developer(config);
53
56
  this.m2m = new M2m(config);
@@ -59,7 +62,6 @@ export class Oystehr {
59
62
  this.project = new Project(config);
60
63
  this.rcm = new Rcm(config);
61
64
  this.erx = new Erx(config);
62
- this.fax = new Fax(config);
63
65
  this.role = new Role(config);
64
66
  this.secret = new Secret(config);
65
67
  this.telemed = new Telemed(config);
@@ -68,6 +70,7 @@ export class Oystehr {
68
70
  this.z3 = new Z3(config);
69
71
  this.zambda = new Zambda(config);
70
72
  this.zambdaLogStream = new ZambdaLogStream(config);
73
+ this.fax = new Fax(config);
71
74
  this.fhir = new Fhir(config);
72
75
  }
73
76
  }