@oystehr/sdk 3.0.6 → 3.0.8

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 (192) hide show
  1. package/README.md +28 -12
  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 +313 -155
  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 +6 -5
  10. package/dist/cjs/resources/classes/charge.d.ts +1 -0
  11. package/dist/cjs/resources/classes/conversation.d.ts +6 -5
  12. package/dist/cjs/resources/classes/developer.d.ts +14 -6
  13. package/dist/cjs/resources/classes/erx.d.ts +9 -0
  14. package/dist/cjs/resources/classes/fax.d.ts +4 -3
  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 +15 -7
  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 +10 -2
  21. package/dist/cjs/resources/classes/rcm.d.ts +4 -3
  22. package/dist/cjs/resources/classes/role.d.ts +6 -5
  23. package/dist/cjs/resources/classes/secret.d.ts +1 -0
  24. package/dist/cjs/resources/classes/telemed.d.ts +2 -1
  25. package/dist/cjs/resources/classes/transactionalSMS.d.ts +2 -1
  26. package/dist/cjs/resources/classes/user.d.ts +15 -7
  27. package/dist/cjs/resources/classes/version.d.ts +1 -0
  28. package/dist/cjs/resources/classes/z3.d.ts +7 -6
  29. package/dist/cjs/resources/classes/zambda.d.ts +9 -8
  30. package/dist/cjs/resources/classes/zambdaLogStream.d.ts +4 -3
  31. package/dist/cjs/resources/types/AccessPolicy.d.ts +8 -3
  32. package/dist/cjs/resources/types/ChargeIssueParams.d.ts +1 -1
  33. package/dist/cjs/resources/types/ChargeStatusParams.d.ts +1 -1
  34. package/dist/cjs/resources/types/DeveloperInviteResponse.d.ts +0 -4
  35. package/dist/cjs/resources/types/DeveloperListV2Params.d.ts +2 -2
  36. package/dist/cjs/resources/types/FaxSendParams.d.ts +1 -1
  37. package/dist/cjs/resources/types/M2mListV2Params.d.ts +2 -2
  38. package/dist/cjs/resources/types/M2mRotateSecretResponse.d.ts +1 -1
  39. package/dist/cjs/resources/types/RcmEligibilityCheckParams.d.ts +1 -1
  40. package/dist/cjs/resources/types/RoleUpdateParams.d.ts +0 -4
  41. package/dist/cjs/resources/types/TelemedCreateMeetingParams.d.ts +1 -1
  42. package/dist/cjs/resources/types/UserListV2Params.d.ts +2 -2
  43. package/dist/cjs/resources/types/ZambdaCreateParams.d.ts +1 -1
  44. package/dist/cjs/resources/types/ZambdaFunction.d.ts +1 -1
  45. package/dist/cjs/resources/types/ZambdaUpdateParams.d.ts +2 -2
  46. package/dist/cjs/resources/types/index.d.ts +2 -2
  47. package/dist/cjs/tests/setup/constants.d.ts +2 -6
  48. package/dist/cjs/tests/setup/global.d.ts +1 -0
  49. package/dist/esm/client/client.d.ts +1 -1
  50. package/dist/esm/client/client.js +4 -4
  51. package/dist/esm/client/client.js.map +1 -1
  52. package/dist/esm/config.d.ts +5 -0
  53. package/dist/esm/errors/index.d.ts +4 -1
  54. package/dist/esm/errors/index.js +18 -2
  55. package/dist/esm/errors/index.js.map +1 -1
  56. package/dist/esm/index.min.js +1 -1
  57. package/dist/esm/index.min.js.map +1 -1
  58. package/dist/esm/resources/classes/application.d.ts +6 -5
  59. package/dist/esm/resources/classes/application.js +20 -13
  60. package/dist/esm/resources/classes/application.js.map +1 -1
  61. package/dist/esm/resources/classes/charge.d.ts +1 -0
  62. package/dist/esm/resources/classes/charge.js +9 -2
  63. package/dist/esm/resources/classes/charge.js.map +1 -1
  64. package/dist/esm/resources/classes/conversation.d.ts +6 -5
  65. package/dist/esm/resources/classes/conversation.js +17 -10
  66. package/dist/esm/resources/classes/conversation.js.map +1 -1
  67. package/dist/esm/resources/classes/developer.d.ts +14 -6
  68. package/dist/esm/resources/classes/developer.js +18 -11
  69. package/dist/esm/resources/classes/developer.js.map +1 -1
  70. package/dist/esm/resources/classes/erx.d.ts +9 -0
  71. package/dist/esm/resources/classes/erx.js +13 -6
  72. package/dist/esm/resources/classes/erx.js.map +1 -1
  73. package/dist/esm/resources/classes/fax.d.ts +4 -3
  74. package/dist/esm/resources/classes/fax.js +13 -6
  75. package/dist/esm/resources/classes/fax.js.map +1 -1
  76. package/dist/esm/resources/classes/fhir.d.ts +1 -0
  77. package/dist/esm/resources/classes/fhir.js +3 -0
  78. package/dist/esm/resources/classes/fhir.js.map +1 -1
  79. package/dist/esm/resources/classes/index.d.ts +1 -1
  80. package/dist/esm/resources/classes/index.js +6 -1
  81. package/dist/esm/resources/classes/index.js.map +1 -1
  82. package/dist/esm/resources/classes/m2m.d.ts +15 -7
  83. package/dist/esm/resources/classes/m2m.js +20 -13
  84. package/dist/esm/resources/classes/m2m.js.map +1 -1
  85. package/dist/esm/resources/classes/messaging.d.ts +1 -0
  86. package/dist/esm/resources/classes/messaging.js +8 -1
  87. package/dist/esm/resources/classes/messaging.js.map +1 -1
  88. package/dist/esm/resources/classes/paymentMethod.d.ts +1 -0
  89. package/dist/esm/resources/classes/paymentMethod.js +11 -4
  90. package/dist/esm/resources/classes/paymentMethod.js.map +1 -1
  91. package/dist/esm/resources/classes/project.d.ts +10 -2
  92. package/dist/esm/resources/classes/project.js +10 -3
  93. package/dist/esm/resources/classes/project.js.map +1 -1
  94. package/dist/esm/resources/classes/rcm.d.ts +4 -3
  95. package/dist/esm/resources/classes/rcm.js +13 -6
  96. package/dist/esm/resources/classes/rcm.js.map +1 -1
  97. package/dist/esm/resources/classes/role.d.ts +6 -5
  98. package/dist/esm/resources/classes/role.js +17 -10
  99. package/dist/esm/resources/classes/role.js.map +1 -1
  100. package/dist/esm/resources/classes/secret.d.ts +1 -0
  101. package/dist/esm/resources/classes/secret.js +11 -4
  102. package/dist/esm/resources/classes/secret.js.map +1 -1
  103. package/dist/esm/resources/classes/telemed.d.ts +2 -1
  104. package/dist/esm/resources/classes/telemed.js +10 -3
  105. package/dist/esm/resources/classes/telemed.js.map +1 -1
  106. package/dist/esm/resources/classes/transactionalSMS.d.ts +2 -1
  107. package/dist/esm/resources/classes/transactionalSMS.js +9 -2
  108. package/dist/esm/resources/classes/transactionalSMS.js.map +1 -1
  109. package/dist/esm/resources/classes/user.d.ts +15 -7
  110. package/dist/esm/resources/classes/user.js +20 -13
  111. package/dist/esm/resources/classes/user.js.map +1 -1
  112. package/dist/esm/resources/classes/version.d.ts +1 -0
  113. package/dist/esm/resources/classes/version.js +8 -1
  114. package/dist/esm/resources/classes/version.js.map +1 -1
  115. package/dist/esm/resources/classes/z3-ext.js +9 -5
  116. package/dist/esm/resources/classes/z3-ext.js.map +1 -1
  117. package/dist/esm/resources/classes/z3.d.ts +7 -6
  118. package/dist/esm/resources/classes/z3.js +19 -12
  119. package/dist/esm/resources/classes/z3.js.map +1 -1
  120. package/dist/esm/resources/classes/zambda-ext.js +5 -1
  121. package/dist/esm/resources/classes/zambda-ext.js.map +1 -1
  122. package/dist/esm/resources/classes/zambda.d.ts +9 -8
  123. package/dist/esm/resources/classes/zambda.js +23 -16
  124. package/dist/esm/resources/classes/zambda.js.map +1 -1
  125. package/dist/esm/resources/classes/zambdaLogStream.d.ts +4 -3
  126. package/dist/esm/resources/classes/zambdaLogStream.js +13 -6
  127. package/dist/esm/resources/classes/zambdaLogStream.js.map +1 -1
  128. package/dist/esm/resources/types/AccessPolicy.d.ts +8 -3
  129. package/dist/esm/resources/types/ChargeIssueParams.d.ts +1 -1
  130. package/dist/esm/resources/types/ChargeStatusParams.d.ts +1 -1
  131. package/dist/esm/resources/types/DeveloperInviteResponse.d.ts +0 -4
  132. package/dist/esm/resources/types/DeveloperListV2Params.d.ts +2 -2
  133. package/dist/esm/resources/types/FaxSendParams.d.ts +1 -1
  134. package/dist/esm/resources/types/M2mListV2Params.d.ts +2 -2
  135. package/dist/esm/resources/types/M2mRotateSecretResponse.d.ts +1 -1
  136. package/dist/esm/resources/types/RcmEligibilityCheckParams.d.ts +1 -1
  137. package/dist/esm/resources/types/RoleUpdateParams.d.ts +0 -4
  138. package/dist/esm/resources/types/TelemedCreateMeetingParams.d.ts +1 -1
  139. package/dist/esm/resources/types/UserListV2Params.d.ts +2 -2
  140. package/dist/esm/resources/types/ZambdaCreateParams.d.ts +1 -1
  141. package/dist/esm/resources/types/ZambdaFunction.d.ts +1 -1
  142. package/dist/esm/resources/types/ZambdaUpdateParams.d.ts +2 -2
  143. package/dist/esm/resources/types/index.d.ts +2 -2
  144. package/dist/esm/tests/setup/constants.d.ts +2 -6
  145. package/dist/esm/tests/setup/global.d.ts +1 -0
  146. package/package.json +3 -3
  147. package/src/client/client.ts +6 -6
  148. package/src/config.ts +5 -0
  149. package/src/errors/index.ts +18 -2
  150. package/src/resources/classes/application.ts +24 -13
  151. package/src/resources/classes/charge.ts +5 -2
  152. package/src/resources/classes/conversation.ts +25 -10
  153. package/src/resources/classes/developer.ts +32 -12
  154. package/src/resources/classes/erx.ts +31 -6
  155. package/src/resources/classes/fax.ts +9 -6
  156. package/src/resources/classes/fhir.ts +3 -0
  157. package/src/resources/classes/index.ts +5 -2
  158. package/src/resources/classes/m2m.ts +31 -14
  159. package/src/resources/classes/messaging.ts +4 -1
  160. package/src/resources/classes/paymentMethod.ts +7 -4
  161. package/src/resources/classes/project.ts +24 -4
  162. package/src/resources/classes/rcm.ts +9 -6
  163. package/src/resources/classes/role.ts +13 -10
  164. package/src/resources/classes/secret.ts +7 -4
  165. package/src/resources/classes/telemed.ts +10 -3
  166. package/src/resources/classes/transactionalSMS.ts +5 -2
  167. package/src/resources/classes/user.ts +34 -14
  168. package/src/resources/classes/version.ts +4 -1
  169. package/src/resources/classes/z3-ext.ts +10 -4
  170. package/src/resources/classes/z3.ts +15 -12
  171. package/src/resources/classes/zambda-ext.ts +5 -1
  172. package/src/resources/classes/zambda.ts +19 -16
  173. package/src/resources/classes/zambdaLogStream.ts +13 -6
  174. package/src/resources/types/AccessPolicy.ts +12 -3
  175. package/src/resources/types/ChargeIssueParams.ts +1 -1
  176. package/src/resources/types/ChargeStatusParams.ts +1 -1
  177. package/src/resources/types/DeveloperInviteResponse.ts +0 -4
  178. package/src/resources/types/DeveloperListV2Params.ts +2 -2
  179. package/src/resources/types/FaxSendParams.ts +1 -1
  180. package/src/resources/types/M2mListV2Params.ts +2 -2
  181. package/src/resources/types/M2mRotateSecretResponse.ts +1 -1
  182. package/src/resources/types/RcmEligibilityCheckParams.ts +1 -1
  183. package/src/resources/types/RoleUpdateParams.ts +0 -4
  184. package/src/resources/types/TelemedCreateMeetingParams.ts +1 -1
  185. package/src/resources/types/UserListV2Params.ts +2 -2
  186. package/src/resources/types/ZambdaCreateParams.ts +1 -1
  187. package/src/resources/types/ZambdaFunction.ts +1 -1
  188. package/src/resources/types/ZambdaUpdateParams.ts +2 -2
  189. package/src/resources/types/index.ts +2 -2
  190. package/dist/esm/node_modules/tslib/package.json +0 -1
  191. package/dist/esm/node_modules/tslib/tslib.es6.js +0 -34
  192. package/dist/esm/node_modules/tslib/tslib.es6.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oystehr/sdk",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
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,50 +24,53 @@ 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
- * 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.
31
+ * Get a list of Applications. [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
29
32
  *
30
33
  * Access Policy Action: `App:ListAllApplications`
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
- * 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
+ * Create a new Application. [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
38
41
  *
39
42
  * Access Policy Action: `App:CreateApplication`
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
- * 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
+ * Get the Application with the provided ID. [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
47
50
  *
48
51
  * Access Policy Action: `App:GetApplication`
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
- * 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
+ * Update the Application with the provided ID. [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
56
59
  *
57
60
  * Access Policy Action: `App:UpdateApplication`
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
- * 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
+ * Delete the Application with the provided ID. [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) provide authentication in front of the web and mobile apps you build on Oystehr.
65
68
  *
66
69
  * Access Policy Action: `App:DeleteApplication`
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,10 @@ 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(
114
+ '/application/{id}/revoke-access-token',
115
+ 'post',
116
+ this.#baseUrlThunk.bind(this)
117
+ )(params, request);
107
118
  }
108
119
  }
@@ -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
  /**
@@ -26,7 +29,7 @@ export class Conversation extends SDKResource {
26
29
  */
27
30
  getConversationIdFromEncounter = ext.getConversationIdFromEncounter;
28
31
  /**
29
- * Create a new 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.
32
+ * Create a new Conversation. [Conversations](https://docs.oystehr.com/oystehr/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.
30
33
  *
31
34
  * Access Policy Requirements:
32
35
  * Action: `Messaging:CreateConversation`
@@ -37,19 +40,19 @@ 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
- * 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
+ * Get a Conversation Token. Conversation Tokens are used to join the Conversation with the Twilio Conversations SDKs. [Conversations](https://docs.oystehr.com/oystehr/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.
44
47
  *
45
48
  * Access Policy Action: `Messaging:GetConversationToken`
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
- * 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.
55
+ * Add a participant to a Conversation. [Conversations](https://docs.oystehr.com/oystehr/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.
53
56
  *
54
57
  * Access Policy Requirements:
55
58
  * Action: `Messaging:ConversationAddParticipant`
@@ -60,10 +63,14 @@ 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
- * 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.
73
+ * Remove a participant from a Conversation. [Conversations](https://docs.oystehr.com/oystehr/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.
67
74
  *
68
75
  * Access Policy Requirements:
69
76
  * Action: `Messaging:ConversationRemoveParticipant`
@@ -72,16 +79,24 @@ 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
- * 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.
89
+ * Send a message to a Conversation. [Conversations](https://docs.oystehr.com/oystehr/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.
79
90
  *
80
91
  * Access Policy Requirements:
81
92
  * Action: `Messaging:ConversationSendMessage`
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,60 +20,80 @@ 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
- * 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.
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/oystehr/services/project/). [Developers](https://docs.oystehr.com/oystehr/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
  *
26
29
  * Access Policy Action: `IAM:GetDeveloper`
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
- * 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
+ * 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/oystehr/services/project/). [Developers](https://docs.oystehr.com/oystehr/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
34
37
  *
35
38
  * Access Policy Action: `IAM:UpdateDeveloper`
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
- * 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
+ * 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/oystehr/services/project/). [Developers](https://docs.oystehr.com/oystehr/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
43
46
  *
44
47
  * Access Policy Action: `IAM:RemoveDeveloper`
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
- * 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
+ * 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/oystehr/services/project/). [Developers](https://docs.oystehr.com/oystehr/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
52
55
  *
53
56
  * Access Policy Action: `IAM:InviteDeveloper`
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.
61
64
  *
62
- * Get a list of all Developers who are part of 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.
65
+ * Get a list of all Developers who are part of the Project. Developer accounts are used to log into the [Developer Console](https://console.oystehr.com/) and administrate [Projects](https://docs.oystehr.com/oystehr/services/project/). [Developers](https://docs.oystehr.com/oystehr/services/iam/developers/) are the only people who can belong to and act across multiple Projects, because they exist above the Project level.
63
66
  *
64
67
  * Access Policy Action: `IAM:ListAllDevelopers`
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
  }
73
+ /**
74
+ * Get Developers in the Project with pagination, sort, sort Order and filtering. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr.
75
+ *
76
+ * Access Policy Action: `Project:ListAllUsers`
77
+ * Access Policy Resource: `Project:Settings`
78
+ */
79
+ listV2(params: DeveloperListV2Params, request?: OystehrClientRequest): Promise<DeveloperListV2Response>;
80
+ /**
81
+ * 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.
82
+ *
83
+ * Access Policy Action: `Project:ListAllUsers`
84
+ * Access Policy Resource: `Project:Settings`
85
+ */
86
+ listV2(request?: OystehrClientRequest): Promise<DeveloperListV2Response>;
70
87
  /**
71
88
  * 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.
72
89
  *
73
90
  * Access Policy Action: `Project:ListAllUsers`
74
91
  * Access Policy Resource: `Project:Settings`
75
92
  */
76
- listV2(params: DeveloperListV2Params, request?: OystehrClientRequest): Promise<DeveloperListV2Response> {
77
- return this.request('/developer/v2/list', 'get')(params, request);
93
+ listV2(
94
+ params?: DeveloperListV2Params | OystehrClientRequest,
95
+ request?: OystehrClientRequest
96
+ ): Promise<DeveloperListV2Response> {
97
+ return this.request('/developer/v2/list', 'get', this.#baseUrlThunk.bind(this))(params, request);
78
98
  }
79
99
  }
@@ -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
@@ -55,8 +58,19 @@ export class Erx extends SDKResource {
55
58
  medicationSearch(
56
59
  params: ErxMedicationSearchParams,
57
60
  request?: OystehrClientRequest
61
+ ): Promise<ErxMedicationSearchResponse>;
62
+ /**
63
+ * Search for medications. Provide at least one of code or name filters
64
+ */
65
+ medicationSearch(request?: OystehrClientRequest): Promise<ErxMedicationSearchResponse>;
66
+ /**
67
+ * Search for medications. Provide at least one of code or name filters
68
+ */
69
+ medicationSearch(
70
+ params?: ErxMedicationSearchParams | OystehrClientRequest,
71
+ request?: OystehrClientRequest
58
72
  ): Promise<ErxMedicationSearchResponse> {
59
- return this.request('/erx/medication/search', 'get')(params, request);
73
+ return this.request('/erx/medication/search', 'get', this.#baseUrlThunk.bind(this))(params, request);
60
74
  }
61
75
  /**
62
76
  * Search for medications. Provide at least one of code or name filters
@@ -64,7 +78,18 @@ export class Erx extends SDKResource {
64
78
  medicationSearchV2(
65
79
  params: ErxMedicationSearchV2Params,
66
80
  request?: OystehrClientRequest
81
+ ): Promise<ErxMedicationSearchV2Response>;
82
+ /**
83
+ * Search for medications. Provide at least one of code or name filters
84
+ */
85
+ medicationSearchV2(request?: OystehrClientRequest): Promise<ErxMedicationSearchV2Response>;
86
+ /**
87
+ * Search for medications. Provide at least one of code or name filters
88
+ */
89
+ medicationSearchV2(
90
+ params?: ErxMedicationSearchV2Params | OystehrClientRequest,
91
+ request?: OystehrClientRequest
67
92
  ): Promise<ErxMedicationSearchV2Response> {
68
- return this.request('/erx/v2/medication/search', 'get')(params, request);
93
+ return this.request('/erx/v2/medication/search', 'get', this.#baseUrlThunk.bind(this))(params, request);
69
94
  }
70
95
  }
@@ -8,34 +8,37 @@ 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
- * 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.
15
+ * Offboard a fax number. Oystehr's [offboard](https://docs.oystehr.com/oystehr/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
  *
14
17
  * Access Policy Requirements:
15
18
  * Action: `Fax:Offboard`
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
- * 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.
25
+ * Onboard a fax number. Oystehr's [onboard](https://docs.oystehr.com/oystehr/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.
23
26
  *
24
27
  * Access Policy Requirements:
25
28
  * Action: `Fax:Onboard`
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
- * 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.
35
+ * Send a fax. Oystehr's [fax sending](https://docs.oystehr.com/oystehr/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.
33
36
  *
34
37
  * Access Policy Requirements:
35
38
  * Action: `Fax:Send`
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
  }