@openrouter/sdk 1.3.36 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/esm/funcs/privateEndpointsActivate.d.ts +19 -0
  2. package/esm/funcs/privateEndpointsActivate.js +103 -0
  3. package/esm/funcs/privateEndpointsCreate.d.ts +19 -0
  4. package/esm/funcs/privateEndpointsCreate.js +101 -0
  5. package/esm/funcs/privateEndpointsDelete.d.ts +19 -0
  6. package/esm/funcs/privateEndpointsDelete.js +107 -0
  7. package/esm/funcs/privateEndpointsDisable.d.ts +19 -0
  8. package/esm/funcs/privateEndpointsDisable.js +103 -0
  9. package/esm/funcs/privateEndpointsEnable.d.ts +19 -0
  10. package/esm/funcs/privateEndpointsEnable.js +103 -0
  11. package/esm/funcs/privateEndpointsGet.d.ts +19 -0
  12. package/esm/funcs/privateEndpointsGet.js +103 -0
  13. package/esm/funcs/privateEndpointsList.d.ts +19 -0
  14. package/esm/funcs/privateEndpointsList.js +97 -0
  15. package/esm/funcs/privateEndpointsUpdate.d.ts +19 -0
  16. package/esm/funcs/privateEndpointsUpdate.js +106 -0
  17. package/esm/funcs/privateEndpointsUpdatePricing.d.ts +19 -0
  18. package/esm/funcs/privateEndpointsUpdatePricing.js +106 -0
  19. package/esm/funcs/privateEndpointsValidate.d.ts +19 -0
  20. package/esm/funcs/privateEndpointsValidate.js +106 -0
  21. package/esm/lib/config.d.ts +2 -2
  22. package/esm/lib/config.js +2 -2
  23. package/esm/models/createprivateendpointrequest.d.ts +67 -0
  24. package/esm/models/createprivateendpointrequest.js +44 -0
  25. package/esm/models/createprivateendpointvalidationfailedresponseerror.d.ts +20 -0
  26. package/esm/models/createprivateendpointvalidationfailedresponseerror.js +27 -0
  27. package/esm/models/deleteprivateendpointresponse.d.ts +19 -0
  28. package/esm/models/deleteprivateendpointresponse.js +21 -0
  29. package/esm/models/errors/createprivateendpoint.d.ts +45 -0
  30. package/esm/models/errors/createprivateendpoint.js +53 -0
  31. package/esm/models/errors/createprivateendpointvalidationfailedresponseerror.d.ts +21 -0
  32. package/esm/models/errors/createprivateendpointvalidationfailedresponseerror.js +35 -0
  33. package/esm/models/errors/index.d.ts +2 -0
  34. package/esm/models/errors/index.js +2 -0
  35. package/esm/models/index.d.ts +21 -0
  36. package/esm/models/index.js +21 -0
  37. package/esm/models/listprivateendpointsresponse.d.ts +11 -0
  38. package/esm/models/listprivateendpointsresponse.js +15 -0
  39. package/esm/models/managedprivateendpoint.d.ts +47 -0
  40. package/esm/models/managedprivateendpoint.js +35 -0
  41. package/esm/models/managedprivateendpointresponse.d.ts +11 -0
  42. package/esm/models/managedprivateendpointresponse.js +15 -0
  43. package/esm/models/operations/activateprivateendpoint.d.ts +58 -0
  44. package/esm/models/operations/activateprivateendpoint.js +21 -0
  45. package/esm/models/operations/createprivateendpoint.d.ts +61 -0
  46. package/esm/models/operations/createprivateendpoint.js +25 -0
  47. package/esm/models/operations/deleteprivateendpoint.d.ts +77 -0
  48. package/esm/models/operations/deleteprivateendpoint.js +34 -0
  49. package/esm/models/operations/disableprivateendpoint.d.ts +58 -0
  50. package/esm/models/operations/disableprivateendpoint.js +21 -0
  51. package/esm/models/operations/enableprivateendpoint.d.ts +58 -0
  52. package/esm/models/operations/enableprivateendpoint.js +21 -0
  53. package/esm/models/operations/getprivateendpoint.d.ts +58 -0
  54. package/esm/models/operations/getprivateendpoint.js +21 -0
  55. package/esm/models/operations/index.d.ts +10 -0
  56. package/esm/models/operations/index.js +10 -0
  57. package/esm/models/operations/listprivateendpoints.d.ts +53 -0
  58. package/esm/models/operations/listprivateendpoints.js +20 -0
  59. package/esm/models/operations/updateprivateendpoint.d.ts +61 -0
  60. package/esm/models/operations/updateprivateendpoint.js +24 -0
  61. package/esm/models/operations/updateprivateendpointpricing.d.ts +61 -0
  62. package/esm/models/operations/updateprivateendpointpricing.js +24 -0
  63. package/esm/models/operations/validateprivateendpoint.d.ts +61 -0
  64. package/esm/models/operations/validateprivateendpoint.js +24 -0
  65. package/esm/models/privateendpoint.d.ts +60 -0
  66. package/esm/models/privateendpoint.js +41 -0
  67. package/esm/models/privateendpointactivation.d.ts +18 -0
  68. package/esm/models/privateendpointactivation.js +18 -0
  69. package/esm/models/privateendpointcheck.d.ts +31 -0
  70. package/esm/models/privateendpointcheck.js +27 -0
  71. package/esm/models/privateendpointcheckreason.d.ts +30 -0
  72. package/esm/models/privateendpointcheckreason.js +29 -0
  73. package/esm/models/privateendpointdeclaredregion.d.ts +17 -0
  74. package/esm/models/privateendpointdeclaredregion.js +16 -0
  75. package/esm/models/privateendpointpricing.d.ts +28 -0
  76. package/esm/models/privateendpointpricing.js +23 -0
  77. package/esm/models/privateendpointresponse.d.ts +11 -0
  78. package/esm/models/privateendpointresponse.js +15 -0
  79. package/esm/models/privateendpointstatus.d.ts +17 -0
  80. package/esm/models/privateendpointstatus.js +16 -0
  81. package/esm/models/privateendpointsummary.d.ts +38 -0
  82. package/esm/models/privateendpointsummary.js +30 -0
  83. package/esm/models/privateendpointvalidation.d.ts +15 -0
  84. package/esm/models/privateendpointvalidation.js +16 -0
  85. package/esm/models/privateendpointvalidationnullable.d.ts +15 -0
  86. package/esm/models/privateendpointvalidationnullable.js +16 -0
  87. package/esm/models/privateendpointvalidationresponse.d.ts +11 -0
  88. package/esm/models/privateendpointvalidationresponse.js +15 -0
  89. package/esm/models/updateprivateendpointpricingrequest.d.ts +16 -0
  90. package/esm/models/updateprivateendpointpricingrequest.js +14 -0
  91. package/esm/models/updateprivateendpointrequest.d.ts +45 -0
  92. package/esm/models/updateprivateendpointrequest.js +36 -0
  93. package/esm/models/validateprivateendpointrequest.d.ts +15 -0
  94. package/esm/models/validateprivateendpointrequest.js +18 -0
  95. package/esm/sdk/privateendpoints.d.ts +76 -0
  96. package/esm/sdk/privateendpoints.js +109 -0
  97. package/esm/sdk/sdk.d.ts +3 -0
  98. package/esm/sdk/sdk.js +4 -0
  99. package/jsr.json +1 -1
  100. package/package.json +5 -5
@@ -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
+ * Activate a validated private endpoint
14
+ *
15
+ * @remarks
16
+ * Make a validated draft routable. Returns 409 when the endpoint was never validated, the validation is stale, or it is already active. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ */
18
+ export declare function privateEndpointsActivate(client: OpenRouterCore, request: operations.ActivatePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.ManagedPrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=privateEndpointsActivate.d.ts.map
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: fb4e7d40387c
4
+ */
5
+ import { 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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { ManagedPrivateEndpointResponse$inboundSchema as models_ManagedPrivateEndpointResponse$inboundSchema } from "../models/managedprivateendpointresponse.js";
14
+ import { ActivatePrivateEndpointRequest$outboundSchema as operations_ActivatePrivateEndpointRequest$outboundSchema } from "../models/operations/activateprivateendpoint.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Activate a validated private endpoint
18
+ *
19
+ * @remarks
20
+ * Make a validated draft routable. Returns 409 when the endpoint was never validated, the validation is stale, or it is already active. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ */
22
+ export function privateEndpointsActivate(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_ActivatePrivateEndpointRequest$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("/private-endpoints/{id}/activate")(pathParams);
39
+ const headers = new Headers(compactMap({
40
+ Accept: "application/json",
41
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
43
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
44
+ }));
45
+ const secConfig = await extractSecurity(client._options.apiKey);
46
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
47
+ const requestSecurity = resolveGlobalSecurity(securityInput);
48
+ const context = {
49
+ options: client._options,
50
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
51
+ operationID: "activatePrivateEndpoint",
52
+ oAuth2Scopes: null,
53
+ resolvedSecurity: requestSecurity,
54
+ securitySource: client._options.apiKey,
55
+ retryConfig: options?.retries
56
+ || client._options.retryConfig
57
+ || {
58
+ strategy: "backoff",
59
+ backoff: {
60
+ initialInterval: 500,
61
+ maxInterval: 60000,
62
+ exponent: 1.5,
63
+ maxElapsedTime: 3600000,
64
+ },
65
+ retryConnectionErrors: true,
66
+ }
67
+ || { strategy: "none" },
68
+ retryCodes: options?.retryCodes || ["5XX"],
69
+ };
70
+ const requestRes = client._createRequest(context, {
71
+ security: requestSecurity,
72
+ method: "POST",
73
+ baseURL: options?.serverURL,
74
+ path: path,
75
+ headers: headers,
76
+ body: body,
77
+ userAgent: client._options.userAgent,
78
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
79
+ }, options);
80
+ if (!requestRes.ok) {
81
+ return [requestRes, { status: "invalid" }];
82
+ }
83
+ const req = requestRes.value;
84
+ const doResult = await client._do(req, {
85
+ context,
86
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
87
+ retryConfig: context.retryConfig,
88
+ retryCodes: context.retryCodes,
89
+ });
90
+ if (!doResult.ok) {
91
+ return [doResult, { status: "request-error", request: req }];
92
+ }
93
+ const response = doResult.value;
94
+ const responseFields = {
95
+ HttpMeta: { Response: response, Request: req },
96
+ };
97
+ const [result] = await M.match(M.json(200, models_ManagedPrivateEndpointResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(422, errors_UnprocessableEntityResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
98
+ if (!result.ok) {
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ //# sourceMappingURL=privateEndpointsActivate.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
+ * Create a private endpoint
14
+ *
15
+ * @remarks
16
+ * Create a private endpoint as a draft. Drafts are not routable: validate one with `POST /private-endpoints/{id}/validate`, then activate it with `POST /private-endpoints/{id}/activate`. Pass `activate` to do all three in one call; if validation fails the draft is kept and returned with the failed checks. Send an `Idempotency-Key` header to make retries safe: a repeated key with the same request returns the endpoint the first request created; reusing it with different fields returns 422 `idempotency_key_reused`. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ */
18
+ export declare function privateEndpointsCreate(client: OpenRouterCore, request: operations.CreatePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.ManagedPrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFound | errors.RequestTimeoutResponseError | errors.Conflict | errors.UnprocessableEntity | errors.InternalServerError | errors.BadGateway | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=privateEndpointsCreate.d.ts.map
@@ -0,0 +1,101 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 59e376dd1895
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 { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { BadGateway$inboundSchema as errors_BadGateway$inboundSchema, Conflict$inboundSchema as errors_Conflict$inboundSchema, InternalServerError$inboundSchema as errors_InternalServerError$inboundSchema, NotFound$inboundSchema as errors_NotFound$inboundSchema, UnprocessableEntity$inboundSchema as errors_UnprocessableEntity$inboundSchema } from "../models/errors/createprivateendpoint.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
13
+ import { ManagedPrivateEndpointResponse$inboundSchema as models_ManagedPrivateEndpointResponse$inboundSchema } from "../models/managedprivateendpointresponse.js";
14
+ import { CreatePrivateEndpointRequest$outboundSchema as operations_CreatePrivateEndpointRequest$outboundSchema } from "../models/operations/createprivateendpoint.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Create a private endpoint
18
+ *
19
+ * @remarks
20
+ * Create a private endpoint as a draft. Drafts are not routable: validate one with `POST /private-endpoints/{id}/validate`, then activate it with `POST /private-endpoints/{id}/activate`. Pass `activate` to do all three in one call; if validation fails the draft is kept and returned with the failed checks. Send an `Idempotency-Key` header to make retries safe: a repeated key with the same request returns the endpoint the first request created; reusing it with different fields returns 422 `idempotency_key_reused`. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ */
22
+ export function privateEndpointsCreate(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_CreatePrivateEndpointRequest$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.CreatePrivateEndpointRequest, {
32
+ explode: true,
33
+ });
34
+ const path = pathToFunc("/private-endpoints")();
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
+ "idempotency-key": encodeSimple("idempotency-key", payload["idempotency-key"], { 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: "createPrivateEndpoint",
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: "POST",
71
+ baseURL: options?.serverURL,
72
+ path: path,
73
+ headers: headers,
74
+ body: body,
75
+ userAgent: client._options.userAgent,
76
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
77
+ }, options);
78
+ if (!requestRes.ok) {
79
+ return [requestRes, { status: "invalid" }];
80
+ }
81
+ const req = requestRes.value;
82
+ const doResult = await client._do(req, {
83
+ context,
84
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
85
+ retryConfig: context.retryConfig,
86
+ retryCodes: context.retryCodes,
87
+ });
88
+ if (!doResult.ok) {
89
+ return [doResult, { status: "request-error", request: req }];
90
+ }
91
+ const response = doResult.value;
92
+ const responseFields = {
93
+ HttpMeta: { Response: response, Request: req },
94
+ };
95
+ const [result] = await M.match(M.json(201, models_ManagedPrivateEndpointResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFound$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_Conflict$inboundSchema), M.jsonErr(422, errors_UnprocessableEntity$inboundSchema), M.jsonErr(500, errors_InternalServerError$inboundSchema), M.jsonErr(502, errors_BadGateway$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
96
+ if (!result.ok) {
97
+ return [result, { status: "complete", request: req, response }];
98
+ }
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
101
+ //# sourceMappingURL=privateEndpointsCreate.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 private endpoint
14
+ *
15
+ * @remarks
16
+ * Delete a private endpoint and stop routing to it. Pass `draft_only=true` to refuse (409) when the endpoint has been activated. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ */
18
+ export declare function privateEndpointsDelete(client: OpenRouterCore, request: operations.DeletePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.DeletePrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=privateEndpointsDelete.d.ts.map
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 475f87370ef8
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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { DeletePrivateEndpointResponse$inboundSchema as models_DeletePrivateEndpointResponse$inboundSchema } from "../models/deleteprivateendpointresponse.js";
14
+ import { DeletePrivateEndpointRequest$outboundSchema as operations_DeletePrivateEndpointRequest$outboundSchema } from "../models/operations/deleteprivateendpoint.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Delete a private endpoint
18
+ *
19
+ * @remarks
20
+ * Delete a private endpoint and stop routing to it. Pass `draft_only=true` to refuse (409) when the endpoint has been activated. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ */
22
+ export function privateEndpointsDelete(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_DeletePrivateEndpointRequest$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("/private-endpoints/{id}")(pathParams);
39
+ const query = encodeFormQuery({
40
+ "draft_only": payload.draft_only,
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: "deletePrivateEndpoint",
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_DeletePrivateEndpointResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(422, errors_UnprocessableEntityResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$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=privateEndpointsDelete.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
+ * Disable a private endpoint
14
+ *
15
+ * @remarks
16
+ * Stop routing to an active endpoint without deleting it. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ */
18
+ export declare function privateEndpointsDisable(client: OpenRouterCore, request: operations.DisablePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.ManagedPrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=privateEndpointsDisable.d.ts.map
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: c89fcb6fd3d0
4
+ */
5
+ import { 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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { ManagedPrivateEndpointResponse$inboundSchema as models_ManagedPrivateEndpointResponse$inboundSchema } from "../models/managedprivateendpointresponse.js";
14
+ import { DisablePrivateEndpointRequest$outboundSchema as operations_DisablePrivateEndpointRequest$outboundSchema } from "../models/operations/disableprivateendpoint.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Disable a private endpoint
18
+ *
19
+ * @remarks
20
+ * Stop routing to an active endpoint without deleting it. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ */
22
+ export function privateEndpointsDisable(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_DisablePrivateEndpointRequest$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("/private-endpoints/{id}/disable")(pathParams);
39
+ const headers = new Headers(compactMap({
40
+ Accept: "application/json",
41
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
43
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
44
+ }));
45
+ const secConfig = await extractSecurity(client._options.apiKey);
46
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
47
+ const requestSecurity = resolveGlobalSecurity(securityInput);
48
+ const context = {
49
+ options: client._options,
50
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
51
+ operationID: "disablePrivateEndpoint",
52
+ oAuth2Scopes: null,
53
+ resolvedSecurity: requestSecurity,
54
+ securitySource: client._options.apiKey,
55
+ retryConfig: options?.retries
56
+ || client._options.retryConfig
57
+ || {
58
+ strategy: "backoff",
59
+ backoff: {
60
+ initialInterval: 500,
61
+ maxInterval: 60000,
62
+ exponent: 1.5,
63
+ maxElapsedTime: 3600000,
64
+ },
65
+ retryConnectionErrors: true,
66
+ }
67
+ || { strategy: "none" },
68
+ retryCodes: options?.retryCodes || ["5XX"],
69
+ };
70
+ const requestRes = client._createRequest(context, {
71
+ security: requestSecurity,
72
+ method: "POST",
73
+ baseURL: options?.serverURL,
74
+ path: path,
75
+ headers: headers,
76
+ body: body,
77
+ userAgent: client._options.userAgent,
78
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
79
+ }, options);
80
+ if (!requestRes.ok) {
81
+ return [requestRes, { status: "invalid" }];
82
+ }
83
+ const req = requestRes.value;
84
+ const doResult = await client._do(req, {
85
+ context,
86
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
87
+ retryConfig: context.retryConfig,
88
+ retryCodes: context.retryCodes,
89
+ });
90
+ if (!doResult.ok) {
91
+ return [doResult, { status: "request-error", request: req }];
92
+ }
93
+ const response = doResult.value;
94
+ const responseFields = {
95
+ HttpMeta: { Response: response, Request: req },
96
+ };
97
+ const [result] = await M.match(M.json(200, models_ManagedPrivateEndpointResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(422, errors_UnprocessableEntityResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
98
+ if (!result.ok) {
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ //# sourceMappingURL=privateEndpointsDisable.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
+ * Enable a private endpoint
14
+ *
15
+ * @remarks
16
+ * Resume routing to a disabled endpoint. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ */
18
+ export declare function privateEndpointsEnable(client: OpenRouterCore, request: operations.EnablePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.ManagedPrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=privateEndpointsEnable.d.ts.map
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 3ccc0615e23f
4
+ */
5
+ import { 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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { ManagedPrivateEndpointResponse$inboundSchema as models_ManagedPrivateEndpointResponse$inboundSchema } from "../models/managedprivateendpointresponse.js";
14
+ import { EnablePrivateEndpointRequest$outboundSchema as operations_EnablePrivateEndpointRequest$outboundSchema } from "../models/operations/enableprivateendpoint.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Enable a private endpoint
18
+ *
19
+ * @remarks
20
+ * Resume routing to a disabled endpoint. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ */
22
+ export function privateEndpointsEnable(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_EnablePrivateEndpointRequest$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("/private-endpoints/{id}/enable")(pathParams);
39
+ const headers = new Headers(compactMap({
40
+ Accept: "application/json",
41
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
43
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
44
+ }));
45
+ const secConfig = await extractSecurity(client._options.apiKey);
46
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
47
+ const requestSecurity = resolveGlobalSecurity(securityInput);
48
+ const context = {
49
+ options: client._options,
50
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
51
+ operationID: "enablePrivateEndpoint",
52
+ oAuth2Scopes: null,
53
+ resolvedSecurity: requestSecurity,
54
+ securitySource: client._options.apiKey,
55
+ retryConfig: options?.retries
56
+ || client._options.retryConfig
57
+ || {
58
+ strategy: "backoff",
59
+ backoff: {
60
+ initialInterval: 500,
61
+ maxInterval: 60000,
62
+ exponent: 1.5,
63
+ maxElapsedTime: 3600000,
64
+ },
65
+ retryConnectionErrors: true,
66
+ }
67
+ || { strategy: "none" },
68
+ retryCodes: options?.retryCodes || ["5XX"],
69
+ };
70
+ const requestRes = client._createRequest(context, {
71
+ security: requestSecurity,
72
+ method: "POST",
73
+ baseURL: options?.serverURL,
74
+ path: path,
75
+ headers: headers,
76
+ body: body,
77
+ userAgent: client._options.userAgent,
78
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
79
+ }, options);
80
+ if (!requestRes.ok) {
81
+ return [requestRes, { status: "invalid" }];
82
+ }
83
+ const req = requestRes.value;
84
+ const doResult = await client._do(req, {
85
+ context,
86
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
87
+ retryConfig: context.retryConfig,
88
+ retryCodes: context.retryCodes,
89
+ });
90
+ if (!doResult.ok) {
91
+ return [doResult, { status: "request-error", request: req }];
92
+ }
93
+ const response = doResult.value;
94
+ const responseFields = {
95
+ HttpMeta: { Response: response, Request: req },
96
+ };
97
+ const [result] = await M.match(M.json(200, models_ManagedPrivateEndpointResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(422, errors_UnprocessableEntityResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
98
+ if (!result.ok) {
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
101
+ return [result, { status: "complete", request: req, response }];
102
+ }
103
+ //# sourceMappingURL=privateEndpointsEnable.js.map