@openrouter/sdk 1.1.24 → 1.1.25
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/esm/funcs/scimCreate.d.ts +19 -0
- package/esm/funcs/scimCreate.js +100 -0
- package/esm/funcs/scimDelete.d.ts +19 -0
- package/esm/funcs/scimDelete.js +107 -0
- package/esm/funcs/scimListGroups.d.ts +21 -0
- package/esm/funcs/scimListGroups.js +133 -0
- package/esm/funcs/scimListMappings.d.ts +21 -0
- package/esm/funcs/scimListMappings.js +133 -0
- package/esm/funcs/scimRead.d.ts +19 -0
- package/esm/funcs/scimRead.js +103 -0
- package/esm/funcs/scimUpdate.d.ts +19 -0
- package/esm/funcs/scimUpdate.js +106 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/createscimgroupmappingrequest.d.ts +24 -0
- package/esm/models/createscimgroupmappingrequest.js +28 -0
- package/esm/models/createscimgroupmappingresponse.d.ts +11 -0
- package/esm/models/createscimgroupmappingresponse.js +15 -0
- package/esm/models/deletescimgroupmappingresponse.d.ts +10 -0
- package/esm/models/deletescimgroupmappingresponse.js +14 -0
- package/esm/models/getscimgroupmappingresponse.d.ts +11 -0
- package/esm/models/getscimgroupmappingresponse.js +15 -0
- package/esm/models/index.d.ts +10 -0
- package/esm/models/index.js +10 -0
- package/esm/models/listscimgroupmappingsresponse.d.ts +12 -0
- package/esm/models/listscimgroupmappingsresponse.js +21 -0
- package/esm/models/listscimgroupsresponse.d.ts +12 -0
- package/esm/models/listscimgroupsresponse.js +21 -0
- package/esm/models/operations/createscimgroupmapping.d.ts +56 -0
- package/esm/models/operations/createscimgroupmapping.js +23 -0
- package/esm/models/operations/deletescimgroupmapping.d.ts +77 -0
- package/esm/models/operations/deletescimgroupmapping.js +35 -0
- package/esm/models/operations/getscimgroupmapping.d.ts +55 -0
- package/esm/models/operations/getscimgroupmapping.js +21 -0
- package/esm/models/operations/index.d.ts +6 -0
- package/esm/models/operations/index.js +6 -0
- package/esm/models/operations/listscimgroupmappings.d.ts +72 -0
- package/esm/models/operations/listscimgroupmappings.js +35 -0
- package/esm/models/operations/listscimgroups.d.ts +72 -0
- package/esm/models/operations/listscimgroups.js +35 -0
- package/esm/models/operations/updatescimgroupmapping.d.ts +58 -0
- package/esm/models/operations/updatescimgroupmapping.js +24 -0
- package/esm/models/scimgroup.d.ts +15 -0
- package/esm/models/scimgroup.js +28 -0
- package/esm/models/scimgroupmapping.d.ts +24 -0
- package/esm/models/scimgroupmapping.js +36 -0
- package/esm/models/updatescimgroupmappingrequest.d.ts +20 -0
- package/esm/models/updatescimgroupmappingrequest.js +20 -0
- package/esm/models/updatescimgroupmappingresponse.d.ts +11 -0
- package/esm/models/updatescimgroupmappingresponse.js +15 -0
- package/esm/sdk/scim.d.ts +53 -0
- package/esm/sdk/scim.js +70 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Create a SCIM group mapping
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Create a SCIM group-to-workspace role mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scimCreate(client: OpenRouterCore, request: operations.CreateScimGroupMappingRequest, options?: RequestOptions): APIPromise<Result<models.CreateScimGroupMappingResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.ConflictResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=scimCreate.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: a8ea14125a34
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Create a SCIM group mapping
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Create a SCIM group-to-workspace role mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function scimCreate(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.CreateScimGroupMappingRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = encodeJSON("body", payload.CreateScimGroupMappingRequest, {
|
|
32
|
+
explode: true,
|
|
33
|
+
});
|
|
34
|
+
const path = pathToFunc("/scim/group-mappings")();
|
|
35
|
+
const headers = new Headers(compactMap({
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
Accept: "application/json",
|
|
38
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
39
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
40
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
41
|
+
}));
|
|
42
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
43
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
44
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
45
|
+
const context = {
|
|
46
|
+
options: client._options,
|
|
47
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
48
|
+
operationID: "createScimGroupMapping",
|
|
49
|
+
oAuth2Scopes: null,
|
|
50
|
+
resolvedSecurity: requestSecurity,
|
|
51
|
+
securitySource: client._options.apiKey,
|
|
52
|
+
retryConfig: options?.retries
|
|
53
|
+
|| client._options.retryConfig
|
|
54
|
+
|| {
|
|
55
|
+
strategy: "backoff",
|
|
56
|
+
backoff: {
|
|
57
|
+
initialInterval: 500,
|
|
58
|
+
maxInterval: 60000,
|
|
59
|
+
exponent: 1.5,
|
|
60
|
+
maxElapsedTime: 3600000,
|
|
61
|
+
},
|
|
62
|
+
retryConnectionErrors: true,
|
|
63
|
+
}
|
|
64
|
+
|| { strategy: "none" },
|
|
65
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
66
|
+
};
|
|
67
|
+
const requestRes = client._createRequest(context, {
|
|
68
|
+
security: requestSecurity,
|
|
69
|
+
method: "POST",
|
|
70
|
+
baseURL: options?.serverURL,
|
|
71
|
+
path: path,
|
|
72
|
+
headers: headers,
|
|
73
|
+
body: body,
|
|
74
|
+
userAgent: client._options.userAgent,
|
|
75
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
76
|
+
}, options);
|
|
77
|
+
if (!requestRes.ok) {
|
|
78
|
+
return [requestRes, { status: "invalid" }];
|
|
79
|
+
}
|
|
80
|
+
const req = requestRes.value;
|
|
81
|
+
const doResult = await client._do(req, {
|
|
82
|
+
context,
|
|
83
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
84
|
+
retryConfig: context.retryConfig,
|
|
85
|
+
retryCodes: context.retryCodes,
|
|
86
|
+
});
|
|
87
|
+
if (!doResult.ok) {
|
|
88
|
+
return [doResult, { status: "request-error", request: req }];
|
|
89
|
+
}
|
|
90
|
+
const response = doResult.value;
|
|
91
|
+
const responseFields = {
|
|
92
|
+
HttpMeta: { Response: response, Request: req },
|
|
93
|
+
};
|
|
94
|
+
const [result] = await M.match(M.json(201, models.CreateScimGroupMappingResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(409, errors.ConflictResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
95
|
+
if (!result.ok) {
|
|
96
|
+
return [result, { status: "complete", request: req, response }];
|
|
97
|
+
}
|
|
98
|
+
return [result, { status: "complete", request: req, response }];
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=scimCreate.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Delete a SCIM group mapping
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Delete a SCIM group-to-workspace mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scimDelete(client: OpenRouterCore, request: operations.DeleteScimGroupMappingRequest, options?: RequestOptions): APIPromise<Result<models.DeleteScimGroupMappingResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=scimDelete.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 441ae3f88a98
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Delete a SCIM group mapping
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Delete a SCIM group-to-workspace mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function scimDelete(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.DeleteScimGroupMappingRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
id: encodeSimple("id", payload.id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
const path = pathToFunc("/scim/group-mappings/{id}")(pathParams);
|
|
39
|
+
const query = encodeFormQuery({
|
|
40
|
+
"keep_members": payload.keep_members,
|
|
41
|
+
});
|
|
42
|
+
const headers = new Headers(compactMap({
|
|
43
|
+
Accept: "application/json",
|
|
44
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
45
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
46
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
47
|
+
}));
|
|
48
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
49
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
50
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
51
|
+
const context = {
|
|
52
|
+
options: client._options,
|
|
53
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
54
|
+
operationID: "deleteScimGroupMapping",
|
|
55
|
+
oAuth2Scopes: null,
|
|
56
|
+
resolvedSecurity: requestSecurity,
|
|
57
|
+
securitySource: client._options.apiKey,
|
|
58
|
+
retryConfig: options?.retries
|
|
59
|
+
|| client._options.retryConfig
|
|
60
|
+
|| {
|
|
61
|
+
strategy: "backoff",
|
|
62
|
+
backoff: {
|
|
63
|
+
initialInterval: 500,
|
|
64
|
+
maxInterval: 60000,
|
|
65
|
+
exponent: 1.5,
|
|
66
|
+
maxElapsedTime: 3600000,
|
|
67
|
+
},
|
|
68
|
+
retryConnectionErrors: true,
|
|
69
|
+
}
|
|
70
|
+
|| { strategy: "none" },
|
|
71
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
72
|
+
};
|
|
73
|
+
const requestRes = client._createRequest(context, {
|
|
74
|
+
security: requestSecurity,
|
|
75
|
+
method: "DELETE",
|
|
76
|
+
baseURL: options?.serverURL,
|
|
77
|
+
path: path,
|
|
78
|
+
headers: headers,
|
|
79
|
+
query: query,
|
|
80
|
+
body: body,
|
|
81
|
+
userAgent: client._options.userAgent,
|
|
82
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
83
|
+
}, options);
|
|
84
|
+
if (!requestRes.ok) {
|
|
85
|
+
return [requestRes, { status: "invalid" }];
|
|
86
|
+
}
|
|
87
|
+
const req = requestRes.value;
|
|
88
|
+
const doResult = await client._do(req, {
|
|
89
|
+
context,
|
|
90
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
91
|
+
retryConfig: context.retryConfig,
|
|
92
|
+
retryCodes: context.retryCodes,
|
|
93
|
+
});
|
|
94
|
+
if (!doResult.ok) {
|
|
95
|
+
return [doResult, { status: "request-error", request: req }];
|
|
96
|
+
}
|
|
97
|
+
const response = doResult.value;
|
|
98
|
+
const responseFields = {
|
|
99
|
+
HttpMeta: { Response: response, Request: req },
|
|
100
|
+
};
|
|
101
|
+
const [result] = await M.match(M.json(200, models.DeleteScimGroupMappingResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
if (!result.ok) {
|
|
103
|
+
return [result, { status: "complete", request: req, response }];
|
|
104
|
+
}
|
|
105
|
+
return [result, { status: "complete", request: req, response }];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=scimDelete.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
import { PageIterator } from "../types/operations.js";
|
|
12
|
+
/**
|
|
13
|
+
* List SCIM groups
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* List SCIM groups for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scimListGroups(client: OpenRouterCore, request?: operations.ListScimGroupsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListScimGroupsResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
|
+
offset: number;
|
|
20
|
+
}>>;
|
|
21
|
+
//# sourceMappingURL=scimListGroups.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: bf94e6973603
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
import { createPageIterator, haltIterator, } from "../types/operations.js";
|
|
16
|
+
/**
|
|
17
|
+
* List SCIM groups
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* List SCIM groups for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function scimListGroups(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListScimGroupsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const path = pathToFunc("/scim/groups")();
|
|
33
|
+
const query = encodeFormQuery({
|
|
34
|
+
"limit": payload?.limit,
|
|
35
|
+
"offset": payload?.offset,
|
|
36
|
+
});
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
40
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
41
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
42
|
+
}));
|
|
43
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
44
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
45
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
46
|
+
const context = {
|
|
47
|
+
options: client._options,
|
|
48
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
49
|
+
operationID: "listScimGroups",
|
|
50
|
+
oAuth2Scopes: null,
|
|
51
|
+
resolvedSecurity: requestSecurity,
|
|
52
|
+
securitySource: client._options.apiKey,
|
|
53
|
+
retryConfig: options?.retries
|
|
54
|
+
|| client._options.retryConfig
|
|
55
|
+
|| {
|
|
56
|
+
strategy: "backoff",
|
|
57
|
+
backoff: {
|
|
58
|
+
initialInterval: 500,
|
|
59
|
+
maxInterval: 60000,
|
|
60
|
+
exponent: 1.5,
|
|
61
|
+
maxElapsedTime: 3600000,
|
|
62
|
+
},
|
|
63
|
+
retryConnectionErrors: true,
|
|
64
|
+
}
|
|
65
|
+
|| { strategy: "none" },
|
|
66
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
67
|
+
};
|
|
68
|
+
const requestRes = client._createRequest(context, {
|
|
69
|
+
security: requestSecurity,
|
|
70
|
+
method: "GET",
|
|
71
|
+
baseURL: options?.serverURL,
|
|
72
|
+
path: path,
|
|
73
|
+
headers: headers,
|
|
74
|
+
query: query,
|
|
75
|
+
body: body,
|
|
76
|
+
userAgent: client._options.userAgent,
|
|
77
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
78
|
+
}, options);
|
|
79
|
+
if (!requestRes.ok) {
|
|
80
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const req = requestRes.value;
|
|
83
|
+
const doResult = await client._do(req, {
|
|
84
|
+
context,
|
|
85
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
86
|
+
retryConfig: context.retryConfig,
|
|
87
|
+
retryCodes: context.retryCodes,
|
|
88
|
+
});
|
|
89
|
+
if (!doResult.ok) {
|
|
90
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
91
|
+
}
|
|
92
|
+
const response = doResult.value;
|
|
93
|
+
const responseFields = {
|
|
94
|
+
HttpMeta: { Response: response, Request: req },
|
|
95
|
+
};
|
|
96
|
+
const [result, raw] = await M.match(M.json(200, operations.ListScimGroupsResponse$inboundSchema, {
|
|
97
|
+
key: "Result",
|
|
98
|
+
}), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
99
|
+
if (!result.ok) {
|
|
100
|
+
return [haltIterator(result), {
|
|
101
|
+
status: "complete",
|
|
102
|
+
request: req,
|
|
103
|
+
response,
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
const nextFunc = (responseData) => {
|
|
107
|
+
const offset = request?.offset ?? 0;
|
|
108
|
+
if (!responseData) {
|
|
109
|
+
return { next: () => null };
|
|
110
|
+
}
|
|
111
|
+
const results = responseData.data;
|
|
112
|
+
if (!Array.isArray(results) || !results.length) {
|
|
113
|
+
return { next: () => null };
|
|
114
|
+
}
|
|
115
|
+
const limit = request?.limit ?? 50;
|
|
116
|
+
if (results.length < limit) {
|
|
117
|
+
return { next: () => null };
|
|
118
|
+
}
|
|
119
|
+
const nextOffset = offset + results.length;
|
|
120
|
+
const nextVal = () => scimListGroups(client, {
|
|
121
|
+
...request,
|
|
122
|
+
offset: nextOffset,
|
|
123
|
+
}, options);
|
|
124
|
+
return { next: nextVal, "~next": { offset: nextOffset } };
|
|
125
|
+
};
|
|
126
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
127
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
128
|
+
status: "complete",
|
|
129
|
+
request: req,
|
|
130
|
+
response,
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=scimListGroups.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
import { PageIterator } from "../types/operations.js";
|
|
12
|
+
/**
|
|
13
|
+
* List SCIM group mappings
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* List SCIM group-to-workspace mappings for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scimListMappings(client: OpenRouterCore, request?: operations.ListScimGroupMappingsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListScimGroupMappingsResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
|
+
offset: number;
|
|
20
|
+
}>>;
|
|
21
|
+
//# sourceMappingURL=scimListMappings.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5c9fe26dc2ff
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
import { createPageIterator, haltIterator, } from "../types/operations.js";
|
|
16
|
+
/**
|
|
17
|
+
* List SCIM group mappings
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* List SCIM group-to-workspace mappings for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
21
|
+
*/
|
|
22
|
+
export function scimListMappings(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListScimGroupMappingsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const path = pathToFunc("/scim/group-mappings")();
|
|
33
|
+
const query = encodeFormQuery({
|
|
34
|
+
"limit": payload?.limit,
|
|
35
|
+
"offset": payload?.offset,
|
|
36
|
+
});
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
40
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
41
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
42
|
+
}));
|
|
43
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
44
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
45
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
46
|
+
const context = {
|
|
47
|
+
options: client._options,
|
|
48
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
49
|
+
operationID: "listScimGroupMappings",
|
|
50
|
+
oAuth2Scopes: null,
|
|
51
|
+
resolvedSecurity: requestSecurity,
|
|
52
|
+
securitySource: client._options.apiKey,
|
|
53
|
+
retryConfig: options?.retries
|
|
54
|
+
|| client._options.retryConfig
|
|
55
|
+
|| {
|
|
56
|
+
strategy: "backoff",
|
|
57
|
+
backoff: {
|
|
58
|
+
initialInterval: 500,
|
|
59
|
+
maxInterval: 60000,
|
|
60
|
+
exponent: 1.5,
|
|
61
|
+
maxElapsedTime: 3600000,
|
|
62
|
+
},
|
|
63
|
+
retryConnectionErrors: true,
|
|
64
|
+
}
|
|
65
|
+
|| { strategy: "none" },
|
|
66
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
67
|
+
};
|
|
68
|
+
const requestRes = client._createRequest(context, {
|
|
69
|
+
security: requestSecurity,
|
|
70
|
+
method: "GET",
|
|
71
|
+
baseURL: options?.serverURL,
|
|
72
|
+
path: path,
|
|
73
|
+
headers: headers,
|
|
74
|
+
query: query,
|
|
75
|
+
body: body,
|
|
76
|
+
userAgent: client._options.userAgent,
|
|
77
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
78
|
+
}, options);
|
|
79
|
+
if (!requestRes.ok) {
|
|
80
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const req = requestRes.value;
|
|
83
|
+
const doResult = await client._do(req, {
|
|
84
|
+
context,
|
|
85
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
86
|
+
retryConfig: context.retryConfig,
|
|
87
|
+
retryCodes: context.retryCodes,
|
|
88
|
+
});
|
|
89
|
+
if (!doResult.ok) {
|
|
90
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
91
|
+
}
|
|
92
|
+
const response = doResult.value;
|
|
93
|
+
const responseFields = {
|
|
94
|
+
HttpMeta: { Response: response, Request: req },
|
|
95
|
+
};
|
|
96
|
+
const [result, raw] = await M.match(M.json(200, operations.ListScimGroupMappingsResponse$inboundSchema, {
|
|
97
|
+
key: "Result",
|
|
98
|
+
}), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
99
|
+
if (!result.ok) {
|
|
100
|
+
return [haltIterator(result), {
|
|
101
|
+
status: "complete",
|
|
102
|
+
request: req,
|
|
103
|
+
response,
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
const nextFunc = (responseData) => {
|
|
107
|
+
const offset = request?.offset ?? 0;
|
|
108
|
+
if (!responseData) {
|
|
109
|
+
return { next: () => null };
|
|
110
|
+
}
|
|
111
|
+
const results = responseData.data;
|
|
112
|
+
if (!Array.isArray(results) || !results.length) {
|
|
113
|
+
return { next: () => null };
|
|
114
|
+
}
|
|
115
|
+
const limit = request?.limit ?? 50;
|
|
116
|
+
if (results.length < limit) {
|
|
117
|
+
return { next: () => null };
|
|
118
|
+
}
|
|
119
|
+
const nextOffset = offset + results.length;
|
|
120
|
+
const nextVal = () => scimListMappings(client, {
|
|
121
|
+
...request,
|
|
122
|
+
offset: nextOffset,
|
|
123
|
+
}, options);
|
|
124
|
+
return { next: nextVal, "~next": { offset: nextOffset } };
|
|
125
|
+
};
|
|
126
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
127
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
128
|
+
status: "complete",
|
|
129
|
+
request: req,
|
|
130
|
+
response,
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=scimListMappings.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Get a SCIM group mapping
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Get a SCIM group-to-workspace mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function scimRead(client: OpenRouterCore, request: operations.GetScimGroupMappingRequest, options?: RequestOptions): APIPromise<Result<models.GetScimGroupMappingResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=scimRead.d.ts.map
|