botshield-sdk 2.0.2 → 2.2.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 +18 -46
- package/bin/mcp-server.js +596 -468
- package/bin/mcp-server.js.map +32 -29
- package/dist/commonjs/funcs/actions-propose-action.d.ts +1 -1
- package/dist/commonjs/funcs/actions-propose-action.js +1 -1
- package/dist/commonjs/funcs/census-get-partner-config.js +2 -78
- package/dist/commonjs/funcs/census-get-partner-config.js.map +1 -1
- package/dist/commonjs/funcs/census-verify-token.d.ts +1 -1
- package/dist/commonjs/funcs/census-verify-token.js +1 -79
- package/dist/commonjs/funcs/census-verify-token.js.map +1 -1
- package/dist/commonjs/funcs/secured-accounts-get-status.d.ts +18 -0
- package/dist/commonjs/funcs/secured-accounts-get-status.d.ts.map +1 -0
- package/dist/commonjs/funcs/secured-accounts-get-status.js +126 -0
- package/dist/commonjs/funcs/secured-accounts-get-status.js.map +1 -0
- package/dist/commonjs/funcs/secured-accounts-list.d.ts +18 -0
- package/dist/commonjs/funcs/secured-accounts-list.d.ts.map +1 -0
- package/dist/commonjs/funcs/secured-accounts-list.js +129 -0
- package/dist/commonjs/funcs/secured-accounts-list.js.map +1 -0
- package/dist/commonjs/funcs/secured-accounts-revoke.d.ts +18 -0
- package/dist/commonjs/funcs/secured-accounts-revoke.d.ts.map +1 -0
- package/dist/commonjs/funcs/secured-accounts-revoke.js +123 -0
- package/dist/commonjs/funcs/secured-accounts-revoke.js.map +1 -0
- package/dist/commonjs/funcs/verification-get-status.js +0 -78
- package/dist/commonjs/funcs/verification-get-status.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +0 -91
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/command.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/command.js +0 -104
- package/dist/commonjs/mcp-server/cli/start/command.js.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/impl.d.ts +0 -13
- package/dist/commonjs/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/impl.js +0 -26
- package/dist/commonjs/mcp-server/cli/start/impl.js.map +1 -1
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/mcp-server/tools/actions-cancel-action.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/actions-cancel-action.js +1 -17
- package/dist/commonjs/mcp-server/tools/actions-cancel-action.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/actions-check-action-status.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/actions-check-action-status.js +1 -17
- package/dist/commonjs/mcp-server/tools/actions-check-action-status.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/actions-propose-action.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/actions-propose-action.js +1 -17
- package/dist/commonjs/mcp-server/tools/actions-propose-action.js.map +1 -1
- package/dist/commonjs/models/error-body.d.ts +43 -8
- package/dist/commonjs/models/error-body.d.ts.map +1 -1
- package/dist/commonjs/models/error-body.js +51 -1
- package/dist/commonjs/models/error-body.js.map +1 -1
- package/dist/commonjs/models/operations/actions-cancel.d.ts +1 -1
- package/dist/commonjs/models/operations/actions-check-status.d.ts +6 -6
- package/dist/commonjs/models/operations/actions-check-status.d.ts.map +1 -1
- package/dist/commonjs/models/operations/actions-check-status.js +6 -6
- package/dist/commonjs/models/operations/actions-check-status.js.map +1 -1
- package/dist/commonjs/models/operations/actions-propose.d.ts +1 -1
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-create-session.d.ts +44 -10
- package/dist/commonjs/models/operations/sdk-create-session.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-create-session.js +32 -11
- package/dist/commonjs/models/operations/sdk-create-session.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-create-verification-link.d.ts +96 -2
- package/dist/commonjs/models/operations/sdk-create-verification-link.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-create-verification-link.js +58 -1
- package/dist/commonjs/models/operations/sdk-create-verification-link.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-get-partner-config.d.ts +23 -27
- package/dist/commonjs/models/operations/sdk-get-partner-config.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-get-partner-config.js +18 -26
- package/dist/commonjs/models/operations/sdk-get-partner-config.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-logout.d.ts +1 -1
- package/dist/commonjs/models/operations/sdk-revoke-verification.d.ts +14 -4
- package/dist/commonjs/models/operations/sdk-revoke-verification.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-revoke-verification.js +4 -2
- package/dist/commonjs/models/operations/sdk-revoke-verification.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-store-signal.d.ts +1 -1
- package/dist/commonjs/models/operations/sdk-validate-signal.d.ts +6 -6
- package/dist/commonjs/models/operations/sdk-validate-signal.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-validate-signal.js +6 -6
- package/dist/commonjs/models/operations/sdk-validate-signal.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-verify-token.d.ts +78 -27
- package/dist/commonjs/models/operations/sdk-verify-token.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-verify-token.js +51 -27
- package/dist/commonjs/models/operations/sdk-verify-token.js.map +1 -1
- package/dist/commonjs/models/operations/secured-accounts-list.d.ts +212 -0
- package/dist/commonjs/models/operations/secured-accounts-list.d.ts.map +1 -0
- package/dist/commonjs/models/operations/secured-accounts-list.js +254 -0
- package/dist/commonjs/models/operations/secured-accounts-list.js.map +1 -0
- package/dist/commonjs/models/operations/secured-accounts-revoke.d.ts +130 -0
- package/dist/commonjs/models/operations/secured-accounts-revoke.d.ts.map +1 -0
- package/dist/commonjs/models/operations/secured-accounts-revoke.js +185 -0
- package/dist/commonjs/models/operations/secured-accounts-revoke.js.map +1 -0
- package/dist/commonjs/models/operations/secured-accounts-status.d.ts +97 -0
- package/dist/commonjs/models/operations/secured-accounts-status.d.ts.map +1 -0
- package/dist/commonjs/models/operations/secured-accounts-status.js +163 -0
- package/dist/commonjs/models/operations/secured-accounts-status.js.map +1 -0
- package/dist/commonjs/models/operations/verification-get-status.d.ts +47 -30
- package/dist/commonjs/models/operations/verification-get-status.d.ts.map +1 -1
- package/dist/commonjs/models/operations/verification-get-status.js +30 -28
- package/dist/commonjs/models/operations/verification-get-status.js.map +1 -1
- package/dist/commonjs/models/security.d.ts +0 -26
- package/dist/commonjs/models/security.d.ts.map +1 -1
- package/dist/commonjs/models/security.js +0 -26
- package/dist/commonjs/models/security.js.map +1 -1
- package/dist/commonjs/sdk/actions.d.ts +1 -1
- package/dist/commonjs/sdk/actions.js +1 -1
- package/dist/commonjs/sdk/census.d.ts +1 -1
- package/dist/commonjs/sdk/census.js +1 -1
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +5 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/secured-accounts.d.ts +26 -0
- package/dist/commonjs/sdk/secured-accounts.d.ts.map +1 -0
- package/dist/commonjs/sdk/secured-accounts.js +42 -0
- package/dist/commonjs/sdk/secured-accounts.js.map +1 -0
- package/dist/esm/funcs/actions-propose-action.d.ts +1 -1
- package/dist/esm/funcs/actions-propose-action.js +1 -1
- package/dist/esm/funcs/census-get-partner-config.js +2 -78
- package/dist/esm/funcs/census-get-partner-config.js.map +1 -1
- package/dist/esm/funcs/census-verify-token.d.ts +1 -1
- package/dist/esm/funcs/census-verify-token.js +1 -79
- package/dist/esm/funcs/census-verify-token.js.map +1 -1
- package/dist/esm/funcs/secured-accounts-get-status.d.ts +18 -0
- package/dist/esm/funcs/secured-accounts-get-status.d.ts.map +1 -0
- package/dist/esm/funcs/secured-accounts-get-status.js +90 -0
- package/dist/esm/funcs/secured-accounts-get-status.js.map +1 -0
- package/dist/esm/funcs/secured-accounts-list.d.ts +18 -0
- package/dist/esm/funcs/secured-accounts-list.d.ts.map +1 -0
- package/dist/esm/funcs/secured-accounts-list.js +93 -0
- package/dist/esm/funcs/secured-accounts-list.js.map +1 -0
- package/dist/esm/funcs/secured-accounts-revoke.d.ts +18 -0
- package/dist/esm/funcs/secured-accounts-revoke.d.ts.map +1 -0
- package/dist/esm/funcs/secured-accounts-revoke.js +87 -0
- package/dist/esm/funcs/secured-accounts-revoke.js.map +1 -0
- package/dist/esm/funcs/verification-get-status.js +0 -78
- package/dist/esm/funcs/verification-get-status.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +0 -91
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/mcp-server/cli/start/command.d.ts.map +1 -1
- package/dist/esm/mcp-server/cli/start/command.js +0 -104
- package/dist/esm/mcp-server/cli/start/command.js.map +1 -1
- package/dist/esm/mcp-server/cli/start/impl.d.ts +0 -13
- package/dist/esm/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/dist/esm/mcp-server/cli/start/impl.js +0 -26
- package/dist/esm/mcp-server/cli/start/impl.js.map +1 -1
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/mcp-server/tools/actions-cancel-action.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/actions-cancel-action.js +1 -17
- package/dist/esm/mcp-server/tools/actions-cancel-action.js.map +1 -1
- package/dist/esm/mcp-server/tools/actions-check-action-status.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/actions-check-action-status.js +1 -17
- package/dist/esm/mcp-server/tools/actions-check-action-status.js.map +1 -1
- package/dist/esm/mcp-server/tools/actions-propose-action.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/actions-propose-action.js +1 -17
- package/dist/esm/mcp-server/tools/actions-propose-action.js.map +1 -1
- package/dist/esm/models/error-body.d.ts +43 -8
- package/dist/esm/models/error-body.d.ts.map +1 -1
- package/dist/esm/models/error-body.js +48 -0
- package/dist/esm/models/error-body.js.map +1 -1
- package/dist/esm/models/operations/actions-cancel.d.ts +1 -1
- package/dist/esm/models/operations/actions-check-status.d.ts +6 -6
- package/dist/esm/models/operations/actions-check-status.d.ts.map +1 -1
- package/dist/esm/models/operations/actions-check-status.js +5 -5
- package/dist/esm/models/operations/actions-check-status.js.map +1 -1
- package/dist/esm/models/operations/actions-propose.d.ts +1 -1
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/sdk-create-session.d.ts +44 -10
- package/dist/esm/models/operations/sdk-create-session.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-create-session.js +29 -8
- package/dist/esm/models/operations/sdk-create-session.js.map +1 -1
- package/dist/esm/models/operations/sdk-create-verification-link.d.ts +96 -2
- package/dist/esm/models/operations/sdk-create-verification-link.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-create-verification-link.js +57 -0
- package/dist/esm/models/operations/sdk-create-verification-link.js.map +1 -1
- package/dist/esm/models/operations/sdk-get-partner-config.d.ts +23 -27
- package/dist/esm/models/operations/sdk-get-partner-config.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-get-partner-config.js +18 -26
- package/dist/esm/models/operations/sdk-get-partner-config.js.map +1 -1
- package/dist/esm/models/operations/sdk-logout.d.ts +1 -1
- package/dist/esm/models/operations/sdk-revoke-verification.d.ts +14 -4
- package/dist/esm/models/operations/sdk-revoke-verification.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-revoke-verification.js +4 -2
- package/dist/esm/models/operations/sdk-revoke-verification.js.map +1 -1
- package/dist/esm/models/operations/sdk-store-signal.d.ts +1 -1
- package/dist/esm/models/operations/sdk-validate-signal.d.ts +6 -6
- package/dist/esm/models/operations/sdk-validate-signal.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-validate-signal.js +5 -5
- package/dist/esm/models/operations/sdk-validate-signal.js.map +1 -1
- package/dist/esm/models/operations/sdk-verify-token.d.ts +78 -27
- package/dist/esm/models/operations/sdk-verify-token.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-verify-token.js +50 -26
- package/dist/esm/models/operations/sdk-verify-token.js.map +1 -1
- package/dist/esm/models/operations/secured-accounts-list.d.ts +212 -0
- package/dist/esm/models/operations/secured-accounts-list.d.ts.map +1 -0
- package/dist/esm/models/operations/secured-accounts-list.js +206 -0
- package/dist/esm/models/operations/secured-accounts-list.js.map +1 -0
- package/dist/esm/models/operations/secured-accounts-revoke.d.ts +130 -0
- package/dist/esm/models/operations/secured-accounts-revoke.d.ts.map +1 -0
- package/dist/esm/models/operations/secured-accounts-revoke.js +139 -0
- package/dist/esm/models/operations/secured-accounts-revoke.js.map +1 -0
- package/dist/esm/models/operations/secured-accounts-status.d.ts +97 -0
- package/dist/esm/models/operations/secured-accounts-status.d.ts.map +1 -0
- package/dist/esm/models/operations/secured-accounts-status.js +117 -0
- package/dist/esm/models/operations/secured-accounts-status.js.map +1 -0
- package/dist/esm/models/operations/verification-get-status.d.ts +47 -30
- package/dist/esm/models/operations/verification-get-status.d.ts.map +1 -1
- package/dist/esm/models/operations/verification-get-status.js +29 -27
- package/dist/esm/models/operations/verification-get-status.js.map +1 -1
- package/dist/esm/models/security.d.ts +0 -26
- package/dist/esm/models/security.d.ts.map +1 -1
- package/dist/esm/models/security.js +0 -26
- package/dist/esm/models/security.js.map +1 -1
- package/dist/esm/sdk/actions.d.ts +1 -1
- package/dist/esm/sdk/actions.js +1 -1
- package/dist/esm/sdk/census.d.ts +1 -1
- package/dist/esm/sdk/census.js +1 -1
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +5 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/secured-accounts.d.ts +26 -0
- package/dist/esm/sdk/secured-accounts.d.ts.map +1 -0
- package/dist/esm/sdk/secured-accounts.js +38 -0
- package/dist/esm/sdk/secured-accounts.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/actions-propose-action.ts +1 -1
- package/src/funcs/census-get-partner-config.ts +2 -91
- package/src/funcs/census-verify-token.ts +1 -92
- package/src/funcs/secured-accounts-get-status.ts +189 -0
- package/src/funcs/secured-accounts-list.ts +194 -0
- package/src/funcs/secured-accounts-revoke.ts +185 -0
- package/src/funcs/verification-get-status.ts +0 -91
- package/src/lib/config.ts +2 -2
- package/src/lib/security.ts +0 -91
- package/src/mcp-server/cli/start/command.ts +0 -104
- package/src/mcp-server/cli/start/impl.ts +0 -39
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/actions-cancel-action.ts +1 -17
- package/src/mcp-server/tools/actions-check-action-status.ts +1 -17
- package/src/mcp-server/tools/actions-propose-action.ts +1 -17
- package/src/models/error-body.ts +95 -8
- package/src/models/operations/actions-cancel.ts +1 -1
- package/src/models/operations/actions-check-status.ts +18 -10
- package/src/models/operations/actions-propose.ts +1 -1
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/sdk-create-session.ts +78 -20
- package/src/models/operations/sdk-create-verification-link.ts +157 -2
- package/src/models/operations/sdk-get-partner-config.ts +41 -53
- package/src/models/operations/sdk-logout.ts +1 -1
- package/src/models/operations/sdk-revoke-verification.ts +18 -6
- package/src/models/operations/sdk-store-signal.ts +1 -1
- package/src/models/operations/sdk-validate-signal.ts +16 -10
- package/src/models/operations/sdk-verify-token.ts +119 -53
- package/src/models/operations/secured-accounts-list.ts +507 -0
- package/src/models/operations/secured-accounts-revoke.ts +359 -0
- package/src/models/operations/secured-accounts-status.ts +296 -0
- package/src/models/operations/verification-get-status.ts +73 -56
- package/src/models/security.ts +0 -52
- package/src/sdk/actions.ts +1 -1
- package/src/sdk/census.ts +1 -1
- package/src/sdk/sdk.ts +6 -0
- package/src/sdk/secured-accounts.ts +69 -0
|
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* Validate a verification token
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* Validates a BotShield attestation JWT — the primary server-side check. Attestations are ES256-signed; the public key is published at /.well-known/jwks.json (kid in the header), so you may also verify locally with any JWT library. Claims are anonymous by construction: the token attests the event, never the person.
|
|
33
|
+
* Validates a BotShield attestation JWT — the primary server-side check. Attestations are ES256-signed; the public key is published at /.well-known/jwks.json (kid in the header), so you may also verify locally with any JWT library. Claims are anonymous by construction: the token attests the event, never the person. Each attestation is for one organization (aud = its organization_id; pass `audience` to enforce it) and one check: a repeat check is flagged `replayed` and refused from 2026-11-15.
|
|
34
34
|
*/
|
|
35
35
|
export function censusVerifyToken(
|
|
36
36
|
client: BotShieldCore,
|
|
@@ -116,97 +116,6 @@ async function $do(
|
|
|
116
116
|
value: security?.apiKeyAuth1,
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
|
-
[
|
|
120
|
-
{
|
|
121
|
-
fieldName: "Authorization",
|
|
122
|
-
type: "apiKey:header",
|
|
123
|
-
value: security?.apiKeyAuth2,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
[
|
|
127
|
-
{
|
|
128
|
-
fieldName: "Authorization",
|
|
129
|
-
type: "apiKey:header",
|
|
130
|
-
value: security?.apiKeyAuth3,
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
[
|
|
134
|
-
{
|
|
135
|
-
fieldName: "Authorization",
|
|
136
|
-
type: "apiKey:header",
|
|
137
|
-
value: security?.apiKeyAuth4,
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
[
|
|
141
|
-
{
|
|
142
|
-
fieldName: "Authorization",
|
|
143
|
-
type: "apiKey:header",
|
|
144
|
-
value: security?.apiKeyAuth5,
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
[
|
|
148
|
-
{
|
|
149
|
-
fieldName: "Authorization",
|
|
150
|
-
type: "apiKey:header",
|
|
151
|
-
value: security?.apiKeyAuth6,
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
[
|
|
155
|
-
{
|
|
156
|
-
fieldName: "Authorization",
|
|
157
|
-
type: "apiKey:header",
|
|
158
|
-
value: security?.apiKeyAuth7,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
[
|
|
162
|
-
{
|
|
163
|
-
fieldName: "Authorization",
|
|
164
|
-
type: "apiKey:header",
|
|
165
|
-
value: security?.apiKeyAuth8,
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
{
|
|
170
|
-
fieldName: "Authorization",
|
|
171
|
-
type: "apiKey:header",
|
|
172
|
-
value: security?.apiKeyAuth9,
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
{
|
|
177
|
-
fieldName: "Authorization",
|
|
178
|
-
type: "apiKey:header",
|
|
179
|
-
value: security?.apiKeyAuth10,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
[
|
|
183
|
-
{
|
|
184
|
-
fieldName: "Authorization",
|
|
185
|
-
type: "apiKey:header",
|
|
186
|
-
value: security?.apiKeyAuth11,
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
[
|
|
190
|
-
{
|
|
191
|
-
fieldName: "Authorization",
|
|
192
|
-
type: "apiKey:header",
|
|
193
|
-
value: security?.apiKeyAuth12,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
[
|
|
197
|
-
{
|
|
198
|
-
fieldName: "Authorization",
|
|
199
|
-
type: "apiKey:header",
|
|
200
|
-
value: security?.apiKeyAuth13,
|
|
201
|
-
},
|
|
202
|
-
],
|
|
203
|
-
[
|
|
204
|
-
{
|
|
205
|
-
fieldName: "Authorization",
|
|
206
|
-
type: "apiKey:header",
|
|
207
|
-
value: security?.apiKeyAuth14,
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
119
|
);
|
|
211
120
|
|
|
212
121
|
const context = {
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BotShieldCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { resolveSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { BotShieldError } from "../models/errors/bot-shield-error.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get Secured Account status
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Is this account a Secured Account, and is the person's recent presence fresh? Returns exactly what the embed widget's live presence stream reports for the same account, so your server and the page always agree: `none` (not secured), `fresh` (secured, recent passkey presence until `fresh_until`), `stale` (secured, presence has lapsed — ask for a passkey again). The environment is your API key's: a `bs_dev_…` key sees and changes development Secured Accounts only, a `bs_prod_…` key production only. Server API keys only — site keys (`pk_…`) are refused.
|
|
34
|
+
*/
|
|
35
|
+
export function securedAccountsGetStatus(
|
|
36
|
+
client: BotShieldCore,
|
|
37
|
+
security: operations.SecuredAccountsStatusSecurity,
|
|
38
|
+
request: operations.SecuredAccountsStatusRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.SecuredAccountsStatusResponse,
|
|
43
|
+
| errors.InvalidInputError
|
|
44
|
+
| errors.ErrorResponse
|
|
45
|
+
| BotShieldError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
security,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: BotShieldCore,
|
|
65
|
+
security: operations.SecuredAccountsStatusSecurity,
|
|
66
|
+
request: operations.SecuredAccountsStatusRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.SecuredAccountsStatusResponse,
|
|
72
|
+
| errors.InvalidInputError
|
|
73
|
+
| errors.ErrorResponse
|
|
74
|
+
| BotShieldError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) =>
|
|
89
|
+
operations.SecuredAccountsStatusRequest$outboundSchema.parse(value),
|
|
90
|
+
"Input validation failed",
|
|
91
|
+
);
|
|
92
|
+
if (!parsed.ok) {
|
|
93
|
+
return [parsed, { status: "invalid" }];
|
|
94
|
+
}
|
|
95
|
+
const payload = parsed.value;
|
|
96
|
+
const body = null;
|
|
97
|
+
|
|
98
|
+
const path = pathToFunc("/secured-accounts/status")();
|
|
99
|
+
|
|
100
|
+
const query = encodeFormQuery({
|
|
101
|
+
"platform_user_ref": payload.platform_user_ref,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const headers = new Headers(compactMap({
|
|
105
|
+
Accept: "application/json",
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const requestSecurity = resolveSecurity(
|
|
109
|
+
[
|
|
110
|
+
{
|
|
111
|
+
fieldName: "Authorization",
|
|
112
|
+
type: "apiKey:header",
|
|
113
|
+
value: security?.apiKeyAuth,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const context = {
|
|
119
|
+
options: client._options,
|
|
120
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
121
|
+
operationID: "SecuredAccountsStatus",
|
|
122
|
+
oAuth2Scopes: null,
|
|
123
|
+
|
|
124
|
+
resolvedSecurity: requestSecurity,
|
|
125
|
+
|
|
126
|
+
securitySource: security,
|
|
127
|
+
retryConfig: options?.retries
|
|
128
|
+
|| client._options.retryConfig
|
|
129
|
+
|| { strategy: "none" },
|
|
130
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const requestRes = client._createRequest(context, {
|
|
134
|
+
security: requestSecurity,
|
|
135
|
+
method: "GET",
|
|
136
|
+
baseURL: options?.serverURL,
|
|
137
|
+
path: path,
|
|
138
|
+
headers: headers,
|
|
139
|
+
query: query,
|
|
140
|
+
body: body,
|
|
141
|
+
userAgent: client._options.userAgent,
|
|
142
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
143
|
+
}, options);
|
|
144
|
+
if (!requestRes.ok) {
|
|
145
|
+
return [requestRes, { status: "invalid" }];
|
|
146
|
+
}
|
|
147
|
+
const req = requestRes.value;
|
|
148
|
+
|
|
149
|
+
const doResult = await client._do(req, {
|
|
150
|
+
context,
|
|
151
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
152
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
153
|
+
retryConfig: context.retryConfig,
|
|
154
|
+
retryCodes: context.retryCodes,
|
|
155
|
+
});
|
|
156
|
+
if (!doResult.ok) {
|
|
157
|
+
return [doResult, { status: "request-error", request: req }];
|
|
158
|
+
}
|
|
159
|
+
const response = doResult.value;
|
|
160
|
+
|
|
161
|
+
const responseFields = {
|
|
162
|
+
HttpMeta: { Response: response, Request: req },
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const [result] = await M.match<
|
|
166
|
+
operations.SecuredAccountsStatusResponse,
|
|
167
|
+
| errors.InvalidInputError
|
|
168
|
+
| errors.ErrorResponse
|
|
169
|
+
| BotShieldError
|
|
170
|
+
| ResponseValidationError
|
|
171
|
+
| ConnectionError
|
|
172
|
+
| RequestAbortedError
|
|
173
|
+
| RequestTimeoutError
|
|
174
|
+
| InvalidRequestError
|
|
175
|
+
| UnexpectedClientError
|
|
176
|
+
| SDKValidationError
|
|
177
|
+
>(
|
|
178
|
+
M.json(200, operations.SecuredAccountsStatusResponse$inboundSchema),
|
|
179
|
+
M.jsonErr(400, errors.InvalidInputError$inboundSchema),
|
|
180
|
+
M.jsonErr(500, errors.ErrorResponse$inboundSchema),
|
|
181
|
+
M.fail("4XX"),
|
|
182
|
+
M.fail("5XX"),
|
|
183
|
+
)(response, req, { extraFields: responseFields });
|
|
184
|
+
if (!result.ok) {
|
|
185
|
+
return [result, { status: "complete", request: req, response }];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return [result, { status: "complete", request: req, response }];
|
|
189
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BotShieldCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { resolveSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { BotShieldError } from "../models/errors/bot-shield-error.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List Secured Accounts
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Your Secured Accounts, newest first. Filter to one account with `platform_user_ref` (exact match) or by `status`. Rows carry the handle and binding facts — never your ref or anything that identifies the person. The environment is your API key's: a `bs_dev_…` key sees and changes development Secured Accounts only, a `bs_prod_…` key production only. Server API keys only — site keys (`pk_…`) are refused.
|
|
34
|
+
*/
|
|
35
|
+
export function securedAccountsList(
|
|
36
|
+
client: BotShieldCore,
|
|
37
|
+
security: operations.SecuredAccountsListSecurity,
|
|
38
|
+
request?: operations.SecuredAccountsListRequest | undefined,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.SecuredAccountsListResponse,
|
|
43
|
+
| errors.InvalidInputError
|
|
44
|
+
| errors.ErrorResponse
|
|
45
|
+
| BotShieldError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
security,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: BotShieldCore,
|
|
65
|
+
security: operations.SecuredAccountsListSecurity,
|
|
66
|
+
request?: operations.SecuredAccountsListRequest | undefined,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.SecuredAccountsListResponse,
|
|
72
|
+
| errors.InvalidInputError
|
|
73
|
+
| errors.ErrorResponse
|
|
74
|
+
| BotShieldError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) =>
|
|
89
|
+
operations.SecuredAccountsListRequest$outboundSchema.optional().parse(
|
|
90
|
+
value,
|
|
91
|
+
),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body = null;
|
|
99
|
+
|
|
100
|
+
const path = pathToFunc("/secured-accounts/list")();
|
|
101
|
+
|
|
102
|
+
const query = encodeFormQuery({
|
|
103
|
+
"limit": payload?.limit,
|
|
104
|
+
"offset": payload?.offset,
|
|
105
|
+
"platform_user_ref": payload?.platform_user_ref,
|
|
106
|
+
"status": payload?.status,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const headers = new Headers(compactMap({
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const requestSecurity = resolveSecurity(
|
|
114
|
+
[
|
|
115
|
+
{
|
|
116
|
+
fieldName: "Authorization",
|
|
117
|
+
type: "apiKey:header",
|
|
118
|
+
value: security?.apiKeyAuth,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const context = {
|
|
124
|
+
options: client._options,
|
|
125
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
126
|
+
operationID: "SecuredAccountsList",
|
|
127
|
+
oAuth2Scopes: null,
|
|
128
|
+
|
|
129
|
+
resolvedSecurity: requestSecurity,
|
|
130
|
+
|
|
131
|
+
securitySource: security,
|
|
132
|
+
retryConfig: options?.retries
|
|
133
|
+
|| client._options.retryConfig
|
|
134
|
+
|| { strategy: "none" },
|
|
135
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const requestRes = client._createRequest(context, {
|
|
139
|
+
security: requestSecurity,
|
|
140
|
+
method: "GET",
|
|
141
|
+
baseURL: options?.serverURL,
|
|
142
|
+
path: path,
|
|
143
|
+
headers: headers,
|
|
144
|
+
query: query,
|
|
145
|
+
body: body,
|
|
146
|
+
userAgent: client._options.userAgent,
|
|
147
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
148
|
+
}, options);
|
|
149
|
+
if (!requestRes.ok) {
|
|
150
|
+
return [requestRes, { status: "invalid" }];
|
|
151
|
+
}
|
|
152
|
+
const req = requestRes.value;
|
|
153
|
+
|
|
154
|
+
const doResult = await client._do(req, {
|
|
155
|
+
context,
|
|
156
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
157
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
158
|
+
retryConfig: context.retryConfig,
|
|
159
|
+
retryCodes: context.retryCodes,
|
|
160
|
+
});
|
|
161
|
+
if (!doResult.ok) {
|
|
162
|
+
return [doResult, { status: "request-error", request: req }];
|
|
163
|
+
}
|
|
164
|
+
const response = doResult.value;
|
|
165
|
+
|
|
166
|
+
const responseFields = {
|
|
167
|
+
HttpMeta: { Response: response, Request: req },
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const [result] = await M.match<
|
|
171
|
+
operations.SecuredAccountsListResponse,
|
|
172
|
+
| errors.InvalidInputError
|
|
173
|
+
| errors.ErrorResponse
|
|
174
|
+
| BotShieldError
|
|
175
|
+
| ResponseValidationError
|
|
176
|
+
| ConnectionError
|
|
177
|
+
| RequestAbortedError
|
|
178
|
+
| RequestTimeoutError
|
|
179
|
+
| InvalidRequestError
|
|
180
|
+
| UnexpectedClientError
|
|
181
|
+
| SDKValidationError
|
|
182
|
+
>(
|
|
183
|
+
M.json(200, operations.SecuredAccountsListResponse$inboundSchema),
|
|
184
|
+
M.jsonErr(400, errors.InvalidInputError$inboundSchema),
|
|
185
|
+
M.jsonErr(500, errors.ErrorResponse$inboundSchema),
|
|
186
|
+
M.fail("4XX"),
|
|
187
|
+
M.fail("5XX"),
|
|
188
|
+
)(response, req, { extraFields: responseFields });
|
|
189
|
+
if (!result.ok) {
|
|
190
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return [result, { status: "complete", request: req, response }];
|
|
194
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BotShieldCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { resolveSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { BotShieldError } from "../models/errors/bot-shield-error.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Revoke a Secured Account
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* End a Secured Account from your server. Send `reason: 'credential_changed'` when a primary sign-in detail changed on your side (password reset, email change, …) — the Secured Accounts spec requires it; the person's app then shows the account as Unlinked with a Re-link action. Your company's agents for that person are revoked with it, `account.unlinked { handle, by: 'platform', unlinked_at, reason, surface_id }` is sent to your webhook endpoints, live widgets for the account update at once, and the person is told. The next passkey ceremony on that account secures it again from scratch. Idempotent: an account that is not secured (or already unlinked) returns `revoked: false`. Select it by `platform_user_ref` or by `handle` — exactly one. The environment is your API key's: a `bs_dev_…` key sees and changes development Secured Accounts only, a `bs_prod_…` key production only. Server API keys only — site keys (`pk_…`) are refused.
|
|
34
|
+
*/
|
|
35
|
+
export function securedAccountsRevoke(
|
|
36
|
+
client: BotShieldCore,
|
|
37
|
+
security: operations.SecuredAccountsRevokeSecurity,
|
|
38
|
+
request: operations.SecuredAccountsRevokeRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.SecuredAccountsRevokeResponse,
|
|
43
|
+
| errors.InvalidInputError
|
|
44
|
+
| errors.ErrorResponse
|
|
45
|
+
| BotShieldError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
security,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: BotShieldCore,
|
|
65
|
+
security: operations.SecuredAccountsRevokeSecurity,
|
|
66
|
+
request: operations.SecuredAccountsRevokeRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.SecuredAccountsRevokeResponse,
|
|
72
|
+
| errors.InvalidInputError
|
|
73
|
+
| errors.ErrorResponse
|
|
74
|
+
| BotShieldError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) =>
|
|
89
|
+
operations.SecuredAccountsRevokeRequest$outboundSchema.parse(value),
|
|
90
|
+
"Input validation failed",
|
|
91
|
+
);
|
|
92
|
+
if (!parsed.ok) {
|
|
93
|
+
return [parsed, { status: "invalid" }];
|
|
94
|
+
}
|
|
95
|
+
const payload = parsed.value;
|
|
96
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
97
|
+
|
|
98
|
+
const path = pathToFunc("/secured-accounts/revoke")();
|
|
99
|
+
|
|
100
|
+
const headers = new Headers(compactMap({
|
|
101
|
+
"Content-Type": "application/json",
|
|
102
|
+
Accept: "application/json",
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const requestSecurity = resolveSecurity(
|
|
106
|
+
[
|
|
107
|
+
{
|
|
108
|
+
fieldName: "Authorization",
|
|
109
|
+
type: "apiKey:header",
|
|
110
|
+
value: security?.apiKeyAuth,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const context = {
|
|
116
|
+
options: client._options,
|
|
117
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
118
|
+
operationID: "SecuredAccountsRevoke",
|
|
119
|
+
oAuth2Scopes: null,
|
|
120
|
+
|
|
121
|
+
resolvedSecurity: requestSecurity,
|
|
122
|
+
|
|
123
|
+
securitySource: security,
|
|
124
|
+
retryConfig: options?.retries
|
|
125
|
+
|| client._options.retryConfig
|
|
126
|
+
|| { strategy: "none" },
|
|
127
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const requestRes = client._createRequest(context, {
|
|
131
|
+
security: requestSecurity,
|
|
132
|
+
method: "POST",
|
|
133
|
+
baseURL: options?.serverURL,
|
|
134
|
+
path: path,
|
|
135
|
+
headers: headers,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
148
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
operations.SecuredAccountsRevokeResponse,
|
|
163
|
+
| errors.InvalidInputError
|
|
164
|
+
| errors.ErrorResponse
|
|
165
|
+
| BotShieldError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.json(200, operations.SecuredAccountsRevokeResponse$inboundSchema),
|
|
175
|
+
M.jsonErr(400, errors.InvalidInputError$inboundSchema),
|
|
176
|
+
M.jsonErr(500, errors.ErrorResponse$inboundSchema),
|
|
177
|
+
M.fail("4XX"),
|
|
178
|
+
M.fail("5XX"),
|
|
179
|
+
)(response, req, { extraFields: responseFields });
|
|
180
|
+
if (!result.ok) {
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return [result, { status: "complete", request: req, response }];
|
|
185
|
+
}
|