@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.
- package/README.md +81 -16
- package/bin/mcp-server.js +39384 -0
- package/bin/mcp-server.js.map +301 -0
- package/funcs/organizationsGetFacility.d.ts +2 -1
- package/funcs/organizationsGetFacility.d.ts.map +1 -1
- package/funcs/organizationsGetFacility.js +11 -7
- package/funcs/organizationsGetFacility.js.map +1 -1
- package/funcs/organizationsListOrSearchFacilities.d.ts +2 -1
- package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -1
- package/funcs/organizationsListOrSearchFacilities.js +11 -7
- package/funcs/organizationsListOrSearchFacilities.js.map +1 -1
- package/funcs/userGetCurrentUser.d.ts +2 -1
- package/funcs/userGetCurrentUser.d.ts.map +1 -1
- package/funcs/userGetCurrentUser.js +10 -6
- package/funcs/userGetCurrentUser.js.map +1 -1
- package/funcs/userGetUserById.d.ts +2 -1
- package/funcs/userGetUserById.d.ts.map +1 -1
- package/funcs/userGetUserById.js +11 -7
- package/funcs/userGetUserById.js.map +1 -1
- package/funcs/userLogsUserIntoTheSystem.d.ts +2 -1
- package/funcs/userLogsUserIntoTheSystem.d.ts.map +1 -1
- package/funcs/userLogsUserIntoTheSystem.js +11 -7
- package/funcs/userLogsUserIntoTheSystem.js.map +1 -1
- package/funcs/userMagiclink.d.ts +17 -0
- package/funcs/userMagiclink.d.ts.map +1 -0
- package/funcs/userMagiclink.js +115 -0
- package/funcs/userMagiclink.js.map +1 -0
- package/funcs/userPassword.d.ts +18 -0
- package/funcs/userPassword.d.ts.map +1 -0
- package/funcs/userPassword.js +116 -0
- package/funcs/userPassword.js.map +1 -0
- package/funcs/userPasswordResetRequest.d.ts +17 -0
- package/funcs/userPasswordResetRequest.d.ts.map +1 -0
- package/funcs/userPasswordResetRequest.js +115 -0
- package/funcs/userPasswordResetRequest.js.map +1 -0
- package/funcs/vendorsCreateVendorRegistration.d.ts +2 -1
- package/funcs/vendorsCreateVendorRegistration.d.ts.map +1 -1
- package/funcs/vendorsCreateVendorRegistration.js +11 -7
- package/funcs/vendorsCreateVendorRegistration.js.map +1 -1
- package/funcs/vendorsListVendorJobTitles.d.ts +2 -1
- package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -1
- package/funcs/vendorsListVendorJobTitles.js +11 -7
- package/funcs/vendorsListVendorJobTitles.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +5 -5
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/files.js.map +1 -1
- package/lib/sdks.d.ts +1 -1
- package/lib/sdks.d.ts.map +1 -1
- package/mcp-server/build.d.mts.map +1 -0
- package/mcp-server/build.mjs +14 -0
- package/mcp-server/build.mjs.map +1 -0
- package/mcp-server/cli/start/command.d.ts +2 -0
- package/mcp-server/cli/start/command.d.ts.map +1 -0
- package/mcp-server/cli/start/command.js +99 -0
- package/mcp-server/cli/start/command.js.map +1 -0
- package/mcp-server/cli/start/impl.d.ts +15 -0
- package/mcp-server/cli/start/impl.d.ts.map +1 -0
- package/mcp-server/cli/start/impl.js +97 -0
- package/mcp-server/cli/start/impl.js.map +1 -0
- package/mcp-server/cli.d.ts +6 -0
- package/mcp-server/cli.d.ts.map +1 -0
- package/mcp-server/cli.js +10 -0
- package/mcp-server/cli.js.map +1 -0
- package/mcp-server/console-logger.d.ts +7 -0
- package/mcp-server/console-logger.d.ts.map +1 -0
- package/mcp-server/console-logger.js +59 -0
- package/mcp-server/console-logger.js.map +1 -0
- package/mcp-server/mcp-server.d.ts +2 -0
- package/mcp-server/mcp-server.d.ts.map +1 -0
- package/mcp-server/mcp-server.js +29 -0
- package/mcp-server/mcp-server.js.map +1 -0
- package/mcp-server/resources.d.ts +27 -0
- package/mcp-server/resources.d.ts.map +1 -0
- package/mcp-server/resources.js +51 -0
- package/mcp-server/resources.js.map +1 -0
- package/mcp-server/scopes.d.ts +3 -0
- package/mcp-server/scopes.d.ts.map +1 -0
- package/mcp-server/scopes.js +8 -0
- package/mcp-server/scopes.js.map +1 -0
- package/mcp-server/server.d.ts +11 -0
- package/mcp-server/server.d.ts.map +1 -0
- package/mcp-server/server.js +44 -0
- package/mcp-server/server.js.map +1 -0
- package/mcp-server/shared.d.ts +7 -0
- package/mcp-server/shared.d.ts.map +1 -0
- package/mcp-server/shared.js +98 -0
- package/mcp-server/shared.js.map +1 -0
- package/mcp-server/tools/organizationsGetFacility.d.ts +8 -0
- package/mcp-server/tools/organizationsGetFacility.d.ts.map +1 -0
- package/mcp-server/tools/organizationsGetFacility.js +64 -0
- package/mcp-server/tools/organizationsGetFacility.js.map +1 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts +8 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts.map +1 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.js +77 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.js.map +1 -0
- package/mcp-server/tools/userGetCurrentUser.d.ts +3 -0
- package/mcp-server/tools/userGetCurrentUser.d.ts.map +1 -0
- package/mcp-server/tools/userGetCurrentUser.js +26 -0
- package/mcp-server/tools/userGetCurrentUser.js.map +1 -0
- package/mcp-server/tools/userGetUserById.d.ts +8 -0
- package/mcp-server/tools/userGetUserById.d.ts.map +1 -0
- package/mcp-server/tools/userGetUserById.js +64 -0
- package/mcp-server/tools/userGetUserById.js.map +1 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts +8 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts.map +1 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.js +94 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.js.map +1 -0
- package/mcp-server/tools/userMagiclink.d.ts +8 -0
- package/mcp-server/tools/userMagiclink.d.ts.map +1 -0
- package/mcp-server/tools/userMagiclink.js +64 -0
- package/mcp-server/tools/userMagiclink.js.map +1 -0
- package/mcp-server/tools/userPassword.d.ts +8 -0
- package/mcp-server/tools/userPassword.d.ts.map +1 -0
- package/mcp-server/tools/userPassword.js +65 -0
- package/mcp-server/tools/userPassword.js.map +1 -0
- package/mcp-server/tools/userPasswordResetRequest.d.ts +8 -0
- package/mcp-server/tools/userPasswordResetRequest.d.ts.map +1 -0
- package/mcp-server/tools/userPasswordResetRequest.js +64 -0
- package/mcp-server/tools/userPasswordResetRequest.js.map +1 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts +8 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts.map +1 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.js +64 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.js.map +1 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.d.ts +8 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.d.ts.map +1 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.js +64 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.js.map +1 -0
- package/mcp-server/tools.d.ts +25 -0
- package/mcp-server/tools.d.ts.map +1 -0
- package/mcp-server/tools.js +74 -0
- package/mcp-server/tools.js.map +1 -0
- package/models/operations/index.d.ts +3 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +3 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/magiclink.d.ts +57 -0
- package/models/operations/magiclink.d.ts.map +1 -0
- package/models/operations/magiclink.js +96 -0
- package/models/operations/magiclink.js.map +1 -0
- package/models/operations/password.d.ts +59 -0
- package/models/operations/password.d.ts.map +1 -0
- package/models/operations/password.js +107 -0
- package/models/operations/password.js.map +1 -0
- package/models/operations/passwordresetrequest.d.ts +57 -0
- package/models/operations/passwordresetrequest.d.ts.map +1 -0
- package/models/operations/passwordresetrequest.js +96 -0
- package/models/operations/passwordresetrequest.js.map +1 -0
- package/package.json +14 -2
- package/react-query/index.d.ts +3 -0
- package/react-query/index.d.ts.map +1 -1
- package/react-query/index.js +3 -0
- package/react-query/index.js.map +1 -1
- package/react-query/userMagiclink.d.ts +23 -0
- package/react-query/userMagiclink.d.ts.map +1 -0
- package/react-query/userMagiclink.js +47 -0
- package/react-query/userMagiclink.js.map +1 -0
- package/react-query/userPassword.d.ts +24 -0
- package/react-query/userPassword.d.ts.map +1 -0
- package/react-query/userPassword.js +48 -0
- package/react-query/userPassword.js.map +1 -0
- package/react-query/userPasswordResetRequest.d.ts +23 -0
- package/react-query/userPasswordResetRequest.d.ts.map +1 -0
- package/react-query/userPasswordResetRequest.js +47 -0
- package/react-query/userPasswordResetRequest.js.map +1 -0
- package/sdk/user.d.ts +22 -0
- package/sdk/user.d.ts.map +1 -1
- package/sdk/user.js +31 -0
- package/sdk/user.js.map +1 -1
- package/src/funcs/organizationsGetFacility.ts +37 -8
- package/src/funcs/organizationsListOrSearchFacilities.ts +35 -8
- package/src/funcs/userGetCurrentUser.ts +33 -7
- package/src/funcs/userGetUserById.ts +36 -8
- package/src/funcs/userLogsUserIntoTheSystem.ts +36 -8
- package/src/funcs/userMagiclink.ts +162 -0
- package/src/funcs/userPassword.ts +163 -0
- package/src/funcs/userPasswordResetRequest.ts +163 -0
- package/src/funcs/vendorsCreateVendorRegistration.ts +36 -8
- package/src/funcs/vendorsListVendorJobTitles.ts +37 -8
- package/src/lib/config.ts +5 -5
- package/src/lib/files.ts +1 -1
- package/src/lib/sdks.ts +1 -1
- package/src/mcp-server/cli/start/command.ts +67 -0
- package/src/mcp-server/cli/start/impl.ts +123 -0
- package/src/mcp-server/cli.ts +13 -0
- package/src/mcp-server/console-logger.ts +71 -0
- package/src/mcp-server/mcp-server.ts +26 -0
- package/src/mcp-server/resources.ts +96 -0
- package/src/mcp-server/scopes.ts +7 -0
- package/src/mcp-server/server.ts +52 -0
- package/src/mcp-server/shared.ts +75 -0
- package/src/mcp-server/tools/organizationsGetFacility.ts +37 -0
- package/src/mcp-server/tools/organizationsListOrSearchFacilities.ts +52 -0
- package/src/mcp-server/tools/userGetCurrentUser.ts +30 -0
- package/src/mcp-server/tools/userGetUserById.ts +37 -0
- package/src/mcp-server/tools/userLogsUserIntoTheSystem.ts +67 -0
- package/src/mcp-server/tools/userMagiclink.ts +37 -0
- package/src/mcp-server/tools/userPassword.ts +38 -0
- package/src/mcp-server/tools/userPasswordResetRequest.ts +37 -0
- package/src/mcp-server/tools/vendorsCreateVendorRegistration.ts +38 -0
- package/src/mcp-server/tools/vendorsListVendorJobTitles.ts +37 -0
- package/src/mcp-server/tools.ts +116 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/magiclink.ts +127 -0
- package/src/models/operations/password.ts +140 -0
- package/src/models/operations/passwordresetrequest.ts +131 -0
- package/src/react-query/index.ts +3 -0
- package/src/react-query/userMagiclink.ts +88 -0
- package/src/react-query/userPassword.ts +89 -0
- package/src/react-query/userPasswordResetRequest.ts +89 -0
- package/src/sdk/user.ts +55 -0
- package/src/types/async.ts +68 -0
- package/types/async.d.ts +23 -0
- package/types/async.d.ts.map +1 -0
- package/types/async.js +44 -0
- package/types/async.js.map +1 -0
- package/.devcontainer/README.md +0 -35
- package/docs/sdks/greensecurity/README.md +0 -14
- package/docs/sdks/organizations/README.md +0 -252
- package/docs/sdks/user/README.md +0 -348
- package/docs/sdks/vendors/README.md +0 -219
package/docs/sdks/user/README.md
DELETED
|
@@ -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 | \*/\* |
|