@greensecurity/javascript-sdk 0.9.1 → 0.11.0

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 (223) hide show
  1. package/README.md +81 -16
  2. package/bin/mcp-server.js +39384 -0
  3. package/bin/mcp-server.js.map +301 -0
  4. package/funcs/organizationsGetFacility.d.ts +2 -1
  5. package/funcs/organizationsGetFacility.d.ts.map +1 -1
  6. package/funcs/organizationsGetFacility.js +11 -7
  7. package/funcs/organizationsGetFacility.js.map +1 -1
  8. package/funcs/organizationsListOrSearchFacilities.d.ts +2 -1
  9. package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -1
  10. package/funcs/organizationsListOrSearchFacilities.js +11 -7
  11. package/funcs/organizationsListOrSearchFacilities.js.map +1 -1
  12. package/funcs/userGetCurrentUser.d.ts +2 -1
  13. package/funcs/userGetCurrentUser.d.ts.map +1 -1
  14. package/funcs/userGetCurrentUser.js +10 -6
  15. package/funcs/userGetCurrentUser.js.map +1 -1
  16. package/funcs/userGetUserById.d.ts +2 -1
  17. package/funcs/userGetUserById.d.ts.map +1 -1
  18. package/funcs/userGetUserById.js +11 -7
  19. package/funcs/userGetUserById.js.map +1 -1
  20. package/funcs/userLogsUserIntoTheSystem.d.ts +2 -1
  21. package/funcs/userLogsUserIntoTheSystem.d.ts.map +1 -1
  22. package/funcs/userLogsUserIntoTheSystem.js +11 -7
  23. package/funcs/userLogsUserIntoTheSystem.js.map +1 -1
  24. package/funcs/userMagiclink.d.ts +17 -0
  25. package/funcs/userMagiclink.d.ts.map +1 -0
  26. package/funcs/userMagiclink.js +115 -0
  27. package/funcs/userMagiclink.js.map +1 -0
  28. package/funcs/userPassword.d.ts +18 -0
  29. package/funcs/userPassword.d.ts.map +1 -0
  30. package/funcs/userPassword.js +116 -0
  31. package/funcs/userPassword.js.map +1 -0
  32. package/funcs/userPasswordResetRequest.d.ts +17 -0
  33. package/funcs/userPasswordResetRequest.d.ts.map +1 -0
  34. package/funcs/userPasswordResetRequest.js +115 -0
  35. package/funcs/userPasswordResetRequest.js.map +1 -0
  36. package/funcs/vendorsCreateVendorRegistration.d.ts +2 -1
  37. package/funcs/vendorsCreateVendorRegistration.d.ts.map +1 -1
  38. package/funcs/vendorsCreateVendorRegistration.js +11 -7
  39. package/funcs/vendorsCreateVendorRegistration.js.map +1 -1
  40. package/funcs/vendorsListVendorJobTitles.d.ts +2 -1
  41. package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -1
  42. package/funcs/vendorsListVendorJobTitles.js +11 -7
  43. package/funcs/vendorsListVendorJobTitles.js.map +1 -1
  44. package/jsr.json +1 -1
  45. package/lib/config.d.ts +5 -5
  46. package/lib/config.d.ts.map +1 -1
  47. package/lib/config.js +3 -3
  48. package/lib/config.js.map +1 -1
  49. package/lib/files.js.map +1 -1
  50. package/lib/sdks.d.ts +1 -1
  51. package/lib/sdks.d.ts.map +1 -1
  52. package/mcp-server/build.d.mts.map +1 -0
  53. package/mcp-server/build.mjs +14 -0
  54. package/mcp-server/build.mjs.map +1 -0
  55. package/mcp-server/cli/start/command.d.ts +2 -0
  56. package/mcp-server/cli/start/command.d.ts.map +1 -0
  57. package/mcp-server/cli/start/command.js +99 -0
  58. package/mcp-server/cli/start/command.js.map +1 -0
  59. package/mcp-server/cli/start/impl.d.ts +15 -0
  60. package/mcp-server/cli/start/impl.d.ts.map +1 -0
  61. package/mcp-server/cli/start/impl.js +97 -0
  62. package/mcp-server/cli/start/impl.js.map +1 -0
  63. package/mcp-server/cli.d.ts +6 -0
  64. package/mcp-server/cli.d.ts.map +1 -0
  65. package/mcp-server/cli.js +10 -0
  66. package/mcp-server/cli.js.map +1 -0
  67. package/mcp-server/console-logger.d.ts +7 -0
  68. package/mcp-server/console-logger.d.ts.map +1 -0
  69. package/mcp-server/console-logger.js +59 -0
  70. package/mcp-server/console-logger.js.map +1 -0
  71. package/mcp-server/mcp-server.d.ts +2 -0
  72. package/mcp-server/mcp-server.d.ts.map +1 -0
  73. package/mcp-server/mcp-server.js +29 -0
  74. package/mcp-server/mcp-server.js.map +1 -0
  75. package/mcp-server/resources.d.ts +27 -0
  76. package/mcp-server/resources.d.ts.map +1 -0
  77. package/mcp-server/resources.js +51 -0
  78. package/mcp-server/resources.js.map +1 -0
  79. package/mcp-server/scopes.d.ts +3 -0
  80. package/mcp-server/scopes.d.ts.map +1 -0
  81. package/mcp-server/scopes.js +8 -0
  82. package/mcp-server/scopes.js.map +1 -0
  83. package/mcp-server/server.d.ts +11 -0
  84. package/mcp-server/server.d.ts.map +1 -0
  85. package/mcp-server/server.js +44 -0
  86. package/mcp-server/server.js.map +1 -0
  87. package/mcp-server/shared.d.ts +7 -0
  88. package/mcp-server/shared.d.ts.map +1 -0
  89. package/mcp-server/shared.js +98 -0
  90. package/mcp-server/shared.js.map +1 -0
  91. package/mcp-server/tools/organizationsGetFacility.d.ts +8 -0
  92. package/mcp-server/tools/organizationsGetFacility.d.ts.map +1 -0
  93. package/mcp-server/tools/organizationsGetFacility.js +64 -0
  94. package/mcp-server/tools/organizationsGetFacility.js.map +1 -0
  95. package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts +8 -0
  96. package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts.map +1 -0
  97. package/mcp-server/tools/organizationsListOrSearchFacilities.js +77 -0
  98. package/mcp-server/tools/organizationsListOrSearchFacilities.js.map +1 -0
  99. package/mcp-server/tools/userGetCurrentUser.d.ts +3 -0
  100. package/mcp-server/tools/userGetCurrentUser.d.ts.map +1 -0
  101. package/mcp-server/tools/userGetCurrentUser.js +26 -0
  102. package/mcp-server/tools/userGetCurrentUser.js.map +1 -0
  103. package/mcp-server/tools/userGetUserById.d.ts +8 -0
  104. package/mcp-server/tools/userGetUserById.d.ts.map +1 -0
  105. package/mcp-server/tools/userGetUserById.js +64 -0
  106. package/mcp-server/tools/userGetUserById.js.map +1 -0
  107. package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts +8 -0
  108. package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts.map +1 -0
  109. package/mcp-server/tools/userLogsUserIntoTheSystem.js +94 -0
  110. package/mcp-server/tools/userLogsUserIntoTheSystem.js.map +1 -0
  111. package/mcp-server/tools/userMagiclink.d.ts +8 -0
  112. package/mcp-server/tools/userMagiclink.d.ts.map +1 -0
  113. package/mcp-server/tools/userMagiclink.js +64 -0
  114. package/mcp-server/tools/userMagiclink.js.map +1 -0
  115. package/mcp-server/tools/userPassword.d.ts +8 -0
  116. package/mcp-server/tools/userPassword.d.ts.map +1 -0
  117. package/mcp-server/tools/userPassword.js +65 -0
  118. package/mcp-server/tools/userPassword.js.map +1 -0
  119. package/mcp-server/tools/userPasswordResetRequest.d.ts +8 -0
  120. package/mcp-server/tools/userPasswordResetRequest.d.ts.map +1 -0
  121. package/mcp-server/tools/userPasswordResetRequest.js +64 -0
  122. package/mcp-server/tools/userPasswordResetRequest.js.map +1 -0
  123. package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts +8 -0
  124. package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts.map +1 -0
  125. package/mcp-server/tools/vendorsCreateVendorRegistration.js +64 -0
  126. package/mcp-server/tools/vendorsCreateVendorRegistration.js.map +1 -0
  127. package/mcp-server/tools/vendorsListVendorJobTitles.d.ts +8 -0
  128. package/mcp-server/tools/vendorsListVendorJobTitles.d.ts.map +1 -0
  129. package/mcp-server/tools/vendorsListVendorJobTitles.js +64 -0
  130. package/mcp-server/tools/vendorsListVendorJobTitles.js.map +1 -0
  131. package/mcp-server/tools.d.ts +25 -0
  132. package/mcp-server/tools.d.ts.map +1 -0
  133. package/mcp-server/tools.js +74 -0
  134. package/mcp-server/tools.js.map +1 -0
  135. package/models/operations/index.d.ts +3 -0
  136. package/models/operations/index.d.ts.map +1 -1
  137. package/models/operations/index.js +3 -0
  138. package/models/operations/index.js.map +1 -1
  139. package/models/operations/magiclink.d.ts +57 -0
  140. package/models/operations/magiclink.d.ts.map +1 -0
  141. package/models/operations/magiclink.js +96 -0
  142. package/models/operations/magiclink.js.map +1 -0
  143. package/models/operations/password.d.ts +59 -0
  144. package/models/operations/password.d.ts.map +1 -0
  145. package/models/operations/password.js +107 -0
  146. package/models/operations/password.js.map +1 -0
  147. package/models/operations/passwordresetrequest.d.ts +57 -0
  148. package/models/operations/passwordresetrequest.d.ts.map +1 -0
  149. package/models/operations/passwordresetrequest.js +96 -0
  150. package/models/operations/passwordresetrequest.js.map +1 -0
  151. package/package.json +14 -2
  152. package/react-query/index.d.ts +3 -0
  153. package/react-query/index.d.ts.map +1 -1
  154. package/react-query/index.js +3 -0
  155. package/react-query/index.js.map +1 -1
  156. package/react-query/userMagiclink.d.ts +23 -0
  157. package/react-query/userMagiclink.d.ts.map +1 -0
  158. package/react-query/userMagiclink.js +47 -0
  159. package/react-query/userMagiclink.js.map +1 -0
  160. package/react-query/userPassword.d.ts +24 -0
  161. package/react-query/userPassword.d.ts.map +1 -0
  162. package/react-query/userPassword.js +48 -0
  163. package/react-query/userPassword.js.map +1 -0
  164. package/react-query/userPasswordResetRequest.d.ts +23 -0
  165. package/react-query/userPasswordResetRequest.d.ts.map +1 -0
  166. package/react-query/userPasswordResetRequest.js +47 -0
  167. package/react-query/userPasswordResetRequest.js.map +1 -0
  168. package/sdk/user.d.ts +22 -0
  169. package/sdk/user.d.ts.map +1 -1
  170. package/sdk/user.js +31 -0
  171. package/sdk/user.js.map +1 -1
  172. package/src/funcs/organizationsGetFacility.ts +37 -8
  173. package/src/funcs/organizationsListOrSearchFacilities.ts +35 -8
  174. package/src/funcs/userGetCurrentUser.ts +33 -7
  175. package/src/funcs/userGetUserById.ts +36 -8
  176. package/src/funcs/userLogsUserIntoTheSystem.ts +36 -8
  177. package/src/funcs/userMagiclink.ts +162 -0
  178. package/src/funcs/userPassword.ts +163 -0
  179. package/src/funcs/userPasswordResetRequest.ts +163 -0
  180. package/src/funcs/vendorsCreateVendorRegistration.ts +36 -8
  181. package/src/funcs/vendorsListVendorJobTitles.ts +37 -8
  182. package/src/lib/config.ts +5 -5
  183. package/src/lib/files.ts +1 -1
  184. package/src/lib/sdks.ts +1 -1
  185. package/src/mcp-server/cli/start/command.ts +67 -0
  186. package/src/mcp-server/cli/start/impl.ts +123 -0
  187. package/src/mcp-server/cli.ts +13 -0
  188. package/src/mcp-server/console-logger.ts +71 -0
  189. package/src/mcp-server/mcp-server.ts +26 -0
  190. package/src/mcp-server/resources.ts +96 -0
  191. package/src/mcp-server/scopes.ts +7 -0
  192. package/src/mcp-server/server.ts +52 -0
  193. package/src/mcp-server/shared.ts +75 -0
  194. package/src/mcp-server/tools/organizationsGetFacility.ts +37 -0
  195. package/src/mcp-server/tools/organizationsListOrSearchFacilities.ts +52 -0
  196. package/src/mcp-server/tools/userGetCurrentUser.ts +30 -0
  197. package/src/mcp-server/tools/userGetUserById.ts +37 -0
  198. package/src/mcp-server/tools/userLogsUserIntoTheSystem.ts +67 -0
  199. package/src/mcp-server/tools/userMagiclink.ts +37 -0
  200. package/src/mcp-server/tools/userPassword.ts +38 -0
  201. package/src/mcp-server/tools/userPasswordResetRequest.ts +37 -0
  202. package/src/mcp-server/tools/vendorsCreateVendorRegistration.ts +38 -0
  203. package/src/mcp-server/tools/vendorsListVendorJobTitles.ts +37 -0
  204. package/src/mcp-server/tools.ts +116 -0
  205. package/src/models/operations/index.ts +3 -0
  206. package/src/models/operations/magiclink.ts +127 -0
  207. package/src/models/operations/password.ts +140 -0
  208. package/src/models/operations/passwordresetrequest.ts +131 -0
  209. package/src/react-query/index.ts +3 -0
  210. package/src/react-query/userMagiclink.ts +88 -0
  211. package/src/react-query/userPassword.ts +89 -0
  212. package/src/react-query/userPasswordResetRequest.ts +89 -0
  213. package/src/sdk/user.ts +55 -0
  214. package/src/types/async.ts +68 -0
  215. package/types/async.d.ts +23 -0
  216. package/types/async.d.ts.map +1 -0
  217. package/types/async.js +44 -0
  218. package/types/async.js.map +1 -0
  219. package/.devcontainer/README.md +0 -35
  220. package/docs/sdks/greensecurity/README.md +0 -14
  221. package/docs/sdks/organizations/README.md +0 -252
  222. package/docs/sdks/user/README.md +0 -348
  223. package/docs/sdks/vendors/README.md +0 -219
@@ -1,348 +0,0 @@
1
- # User
2
- (*user*)
3
-
4
- ## Overview
5
-
6
- Operations about user
7
-
8
- ### Available Operations
9
-
10
- * [getCurrentUser](#getcurrentuser) - Get current user
11
- * [getUserById](#getuserbyid) - Get user by id
12
- * [logsUserIntoTheSystem](#logsuserintothesystem) - Logs user into the system
13
-
14
- ## getCurrentUser
15
-
16
- Returns a user object for the user represented by the authorization token
17
-
18
- ### Example Usage
19
-
20
- ```typescript
21
- import { GreenSecurity } from "@greensecurity/javascript-sdk";
22
-
23
- const greenSecurity = new GreenSecurity({
24
- security: {
25
- token: process.env["GREEN_SECURITY_TOKEN"] ?? "",
26
- },
27
- });
28
-
29
- async function run() {
30
- const result = await greenSecurity.user.getCurrentUser();
31
-
32
- // Handle the result
33
- console.log(result);
34
- }
35
-
36
- run();
37
- ```
38
-
39
- ### Standalone function
40
-
41
- The standalone function version of this method:
42
-
43
- ```typescript
44
- import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
45
- import { userGetCurrentUser } from "@greensecurity/javascript-sdk/funcs/userGetCurrentUser.js";
46
-
47
- // Use `GreenSecurityCore` for best tree-shaking performance.
48
- // You can create one instance of it to use across an application.
49
- const greenSecurity = new GreenSecurityCore({
50
- security: {
51
- token: process.env["GREEN_SECURITY_TOKEN"] ?? "",
52
- },
53
- });
54
-
55
- async function run() {
56
- const res = await userGetCurrentUser(greenSecurity);
57
-
58
- if (!res.ok) {
59
- throw res.error;
60
- }
61
-
62
- const { value: result } = res;
63
-
64
- // Handle the result
65
- console.log(result);
66
- }
67
-
68
- run();
69
- ```
70
-
71
- ### React hooks and utilities
72
-
73
- This method can be used in React components through the following hooks and
74
- associated utilities.
75
-
76
- > Check out [this guide][hook-guide] for information about each of the utilities
77
- > below and how to get started using React hooks.
78
-
79
- [hook-guide]: ../../../REACT_QUERY.md
80
-
81
- ```tsx
82
- import {
83
- // Query hooks for fetching data.
84
- useUserGetCurrentUser,
85
- useUserGetCurrentUserSuspense,
86
-
87
- // Utility for prefetching data during server-side rendering and in React
88
- // Server Components that will be immediately available to client components
89
- // using the hooks.
90
- prefetchUserGetCurrentUser,
91
-
92
- // Utility to invalidate the query cache for this query in response to
93
- // mutations and other user actions.
94
- invalidateAllUserGetCurrentUser,
95
- } from "@greensecurity/javascript-sdk/react-query/userGetCurrentUser.js";
96
- ```
97
-
98
- ### Parameters
99
-
100
- | Parameter | Type | Required | Description |
101
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
102
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
103
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
104
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
105
-
106
- ### Response
107
-
108
- **Promise\<[components.User](../../models/components/user.md)\>**
109
-
110
- ### Errors
111
-
112
- | Error Type | Status Code | Content Type |
113
- | ----------------------- | ----------------------- | ----------------------- |
114
- | errors.ApiErrorResponse | 400, 401, 403, 404 | application/json |
115
- | errors.APIError | 4XX, 5XX | \*/\* |
116
-
117
- ## getUserById
118
-
119
- Returns a user object for the user represented by the identifier in the path.
120
-
121
- ### Example Usage
122
-
123
- ```typescript
124
- import { GreenSecurity } from "@greensecurity/javascript-sdk";
125
-
126
- const greenSecurity = new GreenSecurity({
127
- security: {
128
- token: process.env["GREEN_SECURITY_TOKEN"] ?? "",
129
- },
130
- });
131
-
132
- async function run() {
133
- const result = await greenSecurity.user.getUserById({
134
- id: 923873,
135
- });
136
-
137
- // Handle the result
138
- console.log(result);
139
- }
140
-
141
- run();
142
- ```
143
-
144
- ### Standalone function
145
-
146
- The standalone function version of this method:
147
-
148
- ```typescript
149
- import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
150
- import { userGetUserById } from "@greensecurity/javascript-sdk/funcs/userGetUserById.js";
151
-
152
- // Use `GreenSecurityCore` for best tree-shaking performance.
153
- // You can create one instance of it to use across an application.
154
- const greenSecurity = new GreenSecurityCore({
155
- security: {
156
- token: process.env["GREEN_SECURITY_TOKEN"] ?? "",
157
- },
158
- });
159
-
160
- async function run() {
161
- const res = await userGetUserById(greenSecurity, {
162
- id: 923873,
163
- });
164
-
165
- if (!res.ok) {
166
- throw res.error;
167
- }
168
-
169
- const { value: result } = res;
170
-
171
- // Handle the result
172
- console.log(result);
173
- }
174
-
175
- run();
176
- ```
177
-
178
- ### React hooks and utilities
179
-
180
- This method can be used in React components through the following hooks and
181
- associated utilities.
182
-
183
- > Check out [this guide][hook-guide] for information about each of the utilities
184
- > below and how to get started using React hooks.
185
-
186
- [hook-guide]: ../../../REACT_QUERY.md
187
-
188
- ```tsx
189
- import {
190
- // Query hooks for fetching data.
191
- useUserGetUserById,
192
- useUserGetUserByIdSuspense,
193
-
194
- // Utility for prefetching data during server-side rendering and in React
195
- // Server Components that will be immediately available to client components
196
- // using the hooks.
197
- prefetchUserGetUserById,
198
-
199
- // Utilities to invalidate the query cache for this query in response to
200
- // mutations and other user actions.
201
- invalidateUserGetUserById,
202
- invalidateAllUserGetUserById,
203
- } from "@greensecurity/javascript-sdk/react-query/userGetUserById.js";
204
- ```
205
-
206
- ### Parameters
207
-
208
- | Parameter | Type | Required | Description |
209
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
210
- | `request` | [operations.GetUserByIdRequest](../../models/operations/getuserbyidrequest.md) | :heavy_check_mark: | The request object to use for the request. |
211
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
212
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
213
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
214
-
215
- ### Response
216
-
217
- **Promise\<[components.User](../../models/components/user.md)\>**
218
-
219
- ### Errors
220
-
221
- | Error Type | Status Code | Content Type |
222
- | ----------------------- | ----------------------- | ----------------------- |
223
- | errors.ApiErrorResponse | 400, 401, 403, 404 | application/json |
224
- | errors.APIError | 4XX, 5XX | \*/\* |
225
-
226
- ## logsUserIntoTheSystem
227
-
228
- This endpoint allows a user to authenticate themselves and retrieve a permanent token for access.
229
-
230
- Permanent tokens should only ever be stored in an encrypted storage because they represent a fully logged in user.
231
-
232
- Users may log in with `email/password`, `SAML`, `magic link` or `mfa`. The application should handle all of the above as equally valid login methods.
233
-
234
- The most common way to authenticate a user is to log in with an email and password. If the user provides valid credentials, the server will either respond with a full user object including the token.
235
-
236
- When the user's account is protected via MFA, the server will send a 6 digit code to the user via their default MFA provider. You should collect that code and resend the email, password and mfa_code together to get a successful authentication.
237
-
238
- The ideal flow for a login sequence is the following:
239
-
240
- 1. Present an email address field only and allow the user to submit
241
- 2. Send `email` and `return_url` payload to this endpoint
242
- 3. Follow the flow based on the response `requires` field
243
-
244
- Requires: `password`
245
-
246
- 1. Show a password field for the user to fill out
247
- 2. Submit the `email` and `password` to this endpoint
248
- 3. If the response is `200`, the login is done. If the response is `201`, then check if `requires: mfa_code` is returned and show MFA flow
249
- 4. Submit `email`, `password`, `mfa_code` to this endpoint
250
- 5. If the response is `200`, the login is done. Otherwise, show the appropriate error to the user and go back to step 1 or 3 depending on the error.
251
-
252
- Requires: `saml_login`
253
-
254
- 1. [Open a browser](https://docs.expo.dev/versions/latest/sdk/webbrowser/#webbrowseropenauthsessionasyncurl-redirecturl-options) to the url returned in `sso_url`
255
- 2. User completes sign-in using their configured SAML IdP
256
- 3. Site redirects to your selected `return_url`
257
- 4. The `user_token` will be appended as a query string parameter to your `return_url` - you must parse this token and store it
258
- 5. Fetch the user object from `/users/me` using the token
259
-
260
- ### Example Usage
261
-
262
- ```typescript
263
- import { GreenSecurity } from "@greensecurity/javascript-sdk";
264
-
265
- const greenSecurity = new GreenSecurity();
266
-
267
- async function run() {
268
- const result = await greenSecurity.user.logsUserIntoTheSystem({
269
- email: "user@example.com",
270
- mfaCode: "123456",
271
- password: "Hunter2",
272
- });
273
-
274
- // Handle the result
275
- console.log(result);
276
- }
277
-
278
- run();
279
- ```
280
-
281
- ### Standalone function
282
-
283
- The standalone function version of this method:
284
-
285
- ```typescript
286
- import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
287
- import { userLogsUserIntoTheSystem } from "@greensecurity/javascript-sdk/funcs/userLogsUserIntoTheSystem.js";
288
-
289
- // Use `GreenSecurityCore` for best tree-shaking performance.
290
- // You can create one instance of it to use across an application.
291
- const greenSecurity = new GreenSecurityCore();
292
-
293
- async function run() {
294
- const res = await userLogsUserIntoTheSystem(greenSecurity, {
295
- email: "user@example.com",
296
- mfaCode: "123456",
297
- password: "Hunter2",
298
- });
299
-
300
- if (!res.ok) {
301
- throw res.error;
302
- }
303
-
304
- const { value: result } = res;
305
-
306
- // Handle the result
307
- console.log(result);
308
- }
309
-
310
- run();
311
- ```
312
-
313
- ### React hooks and utilities
314
-
315
- This method can be used in React components through the following hooks and
316
- associated utilities.
317
-
318
- > Check out [this guide][hook-guide] for information about each of the utilities
319
- > below and how to get started using React hooks.
320
-
321
- [hook-guide]: ../../../REACT_QUERY.md
322
-
323
- ```tsx
324
- import {
325
- // Mutation hook for triggering the API call.
326
- useUserLogsUserIntoTheSystemMutation
327
- } from "@greensecurity/javascript-sdk/react-query/userLogsUserIntoTheSystem.js";
328
- ```
329
-
330
- ### Parameters
331
-
332
- | Parameter | Type | Required | Description |
333
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
334
- | `request` | [operations.LogsUserIntoTheSystemRequestBody](../../models/operations/logsuserintothesystemrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
335
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
336
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
337
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
338
-
339
- ### Response
340
-
341
- **Promise\<[operations.LogsUserIntoTheSystemResponse](../../models/operations/logsuserintothesystemresponse.md)\>**
342
-
343
- ### Errors
344
-
345
- | Error Type | Status Code | Content Type |
346
- | ----------------------- | ----------------------- | ----------------------- |
347
- | errors.ApiErrorResponse | 400, 401, 404 | application/json |
348
- | errors.APIError | 4XX, 5XX | \*/\* |
@@ -1,219 +0,0 @@
1
- # Vendors
2
- (*vendors*)
3
-
4
- ## Overview
5
-
6
- Vendors includes anyone that sells goods or services to `Organizations`. Someone is a vendor when they have a contract with a hospital (or looking to establish one).
7
-
8
- ### Available Operations
9
-
10
- * [createVendorRegistration](#createvendorregistration) - Create vendor registration
11
- * [listVendorJobTitles](#listvendorjobtitles) - List vendor job titles
12
-
13
- ## createVendorRegistration
14
-
15
- Create an initial vendor registration. Once successful, the vendor will be able to continue to filling out the rest of their onboarding profile.
16
-
17
- ### Example Usage
18
-
19
- ```typescript
20
- import { GreenSecurity } from "@greensecurity/javascript-sdk";
21
-
22
- const greenSecurity = new GreenSecurity();
23
-
24
- async function run() {
25
- const result = await greenSecurity.vendors.createVendorRegistration({
26
- email: "user@example.com",
27
- password: "Abcdef123!",
28
- timezone: "America/Chicago",
29
- affiliateId: 123,
30
- vendorGroupId: 123,
31
- managingCompanyId: 123,
32
- });
33
-
34
- // Handle the result
35
- console.log(result);
36
- }
37
-
38
- run();
39
- ```
40
-
41
- ### Standalone function
42
-
43
- The standalone function version of this method:
44
-
45
- ```typescript
46
- import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
47
- import { vendorsCreateVendorRegistration } from "@greensecurity/javascript-sdk/funcs/vendorsCreateVendorRegistration.js";
48
-
49
- // Use `GreenSecurityCore` for best tree-shaking performance.
50
- // You can create one instance of it to use across an application.
51
- const greenSecurity = new GreenSecurityCore();
52
-
53
- async function run() {
54
- const res = await vendorsCreateVendorRegistration(greenSecurity, {
55
- email: "user@example.com",
56
- password: "Abcdef123!",
57
- timezone: "America/Chicago",
58
- affiliateId: 123,
59
- vendorGroupId: 123,
60
- managingCompanyId: 123,
61
- });
62
-
63
- if (!res.ok) {
64
- throw res.error;
65
- }
66
-
67
- const { value: result } = res;
68
-
69
- // Handle the result
70
- console.log(result);
71
- }
72
-
73
- run();
74
- ```
75
-
76
- ### React hooks and utilities
77
-
78
- This method can be used in React components through the following hooks and
79
- associated utilities.
80
-
81
- > Check out [this guide][hook-guide] for information about each of the utilities
82
- > below and how to get started using React hooks.
83
-
84
- [hook-guide]: ../../../REACT_QUERY.md
85
-
86
- ```tsx
87
- import {
88
- // Mutation hook for triggering the API call.
89
- useVendorsCreateVendorRegistrationMutation
90
- } from "@greensecurity/javascript-sdk/react-query/vendorsCreateVendorRegistration.js";
91
- ```
92
-
93
- ### Parameters
94
-
95
- | Parameter | Type | Required | Description |
96
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
97
- | `request` | [operations.CreateVendorRegistrationRequestBody](../../models/operations/createvendorregistrationrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
98
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
99
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
100
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
101
-
102
- ### Response
103
-
104
- **Promise\<[operations.CreateVendorRegistrationResponseBody](../../models/operations/createvendorregistrationresponsebody.md)\>**
105
-
106
- ### Errors
107
-
108
- | Error Type | Status Code | Content Type |
109
- | ----------------------- | ----------------------- | ----------------------- |
110
- | errors.ApiErrorResponse | 400, 401, 403, 409 | application/json |
111
- | errors.APIError | 4XX, 5XX | \*/\* |
112
-
113
- ## listVendorJobTitles
114
-
115
- List valid job titles for Vendors. This can be used during sign up or in a filter.
116
-
117
- ### Example Usage
118
-
119
- ```typescript
120
- import { GreenSecurity } from "@greensecurity/javascript-sdk";
121
-
122
- const greenSecurity = new GreenSecurity();
123
-
124
- async function run() {
125
- const result = await greenSecurity.vendors.listVendorJobTitles({
126
- sort: "job",
127
- desc: true,
128
- itemsPerPage: 25,
129
- jobLike: "job",
130
- });
131
-
132
- // Handle the result
133
- console.log(result);
134
- }
135
-
136
- run();
137
- ```
138
-
139
- ### Standalone function
140
-
141
- The standalone function version of this method:
142
-
143
- ```typescript
144
- import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
145
- import { vendorsListVendorJobTitles } from "@greensecurity/javascript-sdk/funcs/vendorsListVendorJobTitles.js";
146
-
147
- // Use `GreenSecurityCore` for best tree-shaking performance.
148
- // You can create one instance of it to use across an application.
149
- const greenSecurity = new GreenSecurityCore();
150
-
151
- async function run() {
152
- const res = await vendorsListVendorJobTitles(greenSecurity, {
153
- sort: "job",
154
- desc: true,
155
- itemsPerPage: 25,
156
- jobLike: "job",
157
- });
158
-
159
- if (!res.ok) {
160
- throw res.error;
161
- }
162
-
163
- const { value: result } = res;
164
-
165
- // Handle the result
166
- console.log(result);
167
- }
168
-
169
- run();
170
- ```
171
-
172
- ### React hooks and utilities
173
-
174
- This method can be used in React components through the following hooks and
175
- associated utilities.
176
-
177
- > Check out [this guide][hook-guide] for information about each of the utilities
178
- > below and how to get started using React hooks.
179
-
180
- [hook-guide]: ../../../REACT_QUERY.md
181
-
182
- ```tsx
183
- import {
184
- // Query hooks for fetching data.
185
- useVendorsListVendorJobTitles,
186
- useVendorsListVendorJobTitlesSuspense,
187
-
188
- // Utility for prefetching data during server-side rendering and in React
189
- // Server Components that will be immediately available to client components
190
- // using the hooks.
191
- prefetchVendorsListVendorJobTitles,
192
-
193
- // Utilities to invalidate the query cache for this query in response to
194
- // mutations and other user actions.
195
- invalidateVendorsListVendorJobTitles,
196
- invalidateAllVendorsListVendorJobTitles,
197
- } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
198
- ```
199
-
200
- ### Parameters
201
-
202
- | Parameter | Type | Required | Description |
203
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
204
- | `request` | [operations.ListVendorJobTitlesRequest](../../models/operations/listvendorjobtitlesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
205
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
206
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
207
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
208
-
209
- ### Response
210
-
211
- **Promise\<[operations.ListVendorJobTitlesResponseBody](../../models/operations/listvendorjobtitlesresponsebody.md)\>**
212
-
213
- ### Errors
214
-
215
- | Error Type | Status Code | Content Type |
216
- | ----------------------- | ----------------------- | ----------------------- |
217
- | errors.ApiErrorResponse | 403 | application/json |
218
- | errors.ApiErrorResponse | 500 | application/json |
219
- | errors.APIError | 4XX, 5XX | \*/\* |