@aerostack/sdk-node 0.5.1 → 0.6.1

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 (71) hide show
  1. package/README.md +5 -0
  2. package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.d.ts +17 -0
  3. package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.js +114 -0
  5. package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.js.map +1 -0
  6. package/dist/commonjs/hooks/registration.d.ts +5 -0
  7. package/dist/commonjs/hooks/registration.d.ts.map +1 -1
  8. package/dist/commonjs/hooks/registration.js +18 -8
  9. package/dist/commonjs/hooks/registration.js.map +1 -1
  10. package/dist/commonjs/lib/config.d.ts +2 -2
  11. package/dist/commonjs/lib/config.js +2 -2
  12. package/dist/commonjs/sdk/billing.d.ts +12 -0
  13. package/dist/commonjs/sdk/billing.d.ts.map +1 -0
  14. package/dist/commonjs/sdk/billing.js +22 -0
  15. package/dist/commonjs/sdk/billing.js.map +1 -0
  16. package/dist/commonjs/sdk/gateway.d.ts +7 -0
  17. package/dist/commonjs/sdk/gateway.d.ts.map +1 -0
  18. package/dist/commonjs/sdk/gateway.js +15 -0
  19. package/dist/commonjs/sdk/gateway.js.map +1 -0
  20. package/dist/commonjs/sdk/models/operations/gatewaybillinglog.d.ts +47 -0
  21. package/dist/commonjs/sdk/models/operations/gatewaybillinglog.d.ts.map +1 -0
  22. package/dist/commonjs/sdk/models/operations/gatewaybillinglog.js +72 -0
  23. package/dist/commonjs/sdk/models/operations/gatewaybillinglog.js.map +1 -0
  24. package/dist/commonjs/sdk/models/operations/index.d.ts +1 -0
  25. package/dist/commonjs/sdk/models/operations/index.d.ts.map +1 -1
  26. package/dist/commonjs/sdk/models/operations/index.js +1 -0
  27. package/dist/commonjs/sdk/models/operations/index.js.map +1 -1
  28. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  29. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  30. package/dist/commonjs/sdk/sdk.js +4 -0
  31. package/dist/commonjs/sdk/sdk.js.map +1 -1
  32. package/dist/esm/funcs/gatewayBillingGatewayBillingLog.d.ts +17 -0
  33. package/dist/esm/funcs/gatewayBillingGatewayBillingLog.d.ts.map +1 -0
  34. package/dist/esm/funcs/gatewayBillingGatewayBillingLog.js +78 -0
  35. package/dist/esm/funcs/gatewayBillingGatewayBillingLog.js.map +1 -0
  36. package/dist/esm/hooks/registration.d.ts +5 -0
  37. package/dist/esm/hooks/registration.d.ts.map +1 -1
  38. package/dist/esm/hooks/registration.js +17 -8
  39. package/dist/esm/hooks/registration.js.map +1 -1
  40. package/dist/esm/lib/config.d.ts +2 -2
  41. package/dist/esm/lib/config.js +2 -2
  42. package/dist/esm/sdk/billing.d.ts +12 -0
  43. package/dist/esm/sdk/billing.d.ts.map +1 -0
  44. package/dist/esm/sdk/billing.js +18 -0
  45. package/dist/esm/sdk/billing.js.map +1 -0
  46. package/dist/esm/sdk/gateway.d.ts +7 -0
  47. package/dist/esm/sdk/gateway.d.ts.map +1 -0
  48. package/dist/esm/sdk/gateway.js +11 -0
  49. package/dist/esm/sdk/gateway.js.map +1 -0
  50. package/dist/esm/sdk/models/operations/gatewaybillinglog.d.ts +47 -0
  51. package/dist/esm/sdk/models/operations/gatewaybillinglog.d.ts.map +1 -0
  52. package/dist/esm/sdk/models/operations/gatewaybillinglog.js +33 -0
  53. package/dist/esm/sdk/models/operations/gatewaybillinglog.js.map +1 -0
  54. package/dist/esm/sdk/models/operations/index.d.ts +1 -0
  55. package/dist/esm/sdk/models/operations/index.d.ts.map +1 -1
  56. package/dist/esm/sdk/models/operations/index.js +1 -0
  57. package/dist/esm/sdk/models/operations/index.js.map +1 -1
  58. package/dist/esm/sdk/sdk.d.ts +3 -0
  59. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  60. package/dist/esm/sdk/sdk.js +4 -0
  61. package/dist/esm/sdk/sdk.js.map +1 -1
  62. package/jsr.json +1 -1
  63. package/package.json +5 -3
  64. package/src/funcs/gatewayBillingGatewayBillingLog.ts +160 -0
  65. package/src/hooks/registration.ts +20 -9
  66. package/src/lib/config.ts +2 -2
  67. package/src/sdk/billing.ts +27 -0
  68. package/src/sdk/gateway.ts +13 -0
  69. package/src/sdk/models/operations/gatewaybillinglog.ts +110 -0
  70. package/src/sdk/models/operations/index.ts +1 -0
  71. package/src/sdk/sdk.ts +6 -0
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "1.0.0",
68
- sdkVersion: "0.3.2",
68
+ sdkVersion: "0.3.3",
69
69
  genVersion: "2.823.4",
70
- userAgent: "speakeasy-sdk/typescript 0.3.2 2.823.4 1.0.0 @aerostack/sdk-node",
70
+ userAgent: "speakeasy-sdk/typescript 0.3.3 2.823.4 1.0.0 @aerostack/sdk-node",
71
71
  } as const;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { gatewayBillingGatewayBillingLog } from "../funcs/gatewayBillingGatewayBillingLog.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as operations from "./models/operations/index.js";
8
+ import { unwrapAsync } from "./types/fp.js";
9
+
10
+ export class Billing extends ClientSDK {
11
+ /**
12
+ * Log Gateway usage
13
+ *
14
+ * @remarks
15
+ * Manually log tokens or custom metric usage for a Gateway API
16
+ */
17
+ async gatewayBillingLog(
18
+ request: operations.GatewayBillingLogRequestBody,
19
+ options?: RequestOptions,
20
+ ): Promise<operations.GatewayBillingLogResponse> {
21
+ return unwrapAsync(gatewayBillingGatewayBillingLog(
22
+ this,
23
+ request,
24
+ options,
25
+ ));
26
+ }
27
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ClientSDK } from "../lib/sdks.js";
6
+ import { Billing } from "./billing.js";
7
+
8
+ export class Gateway extends ClientSDK {
9
+ private _billing?: Billing;
10
+ get billing(): Billing {
11
+ return (this._billing ??= new Billing(this._options));
12
+ }
13
+ }
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import * as shared from "../shared/index.js";
10
+
11
+ export type GatewayBillingLogRequestBody = {
12
+ /**
13
+ * The Consumer ID making the request
14
+ */
15
+ consumerId: string;
16
+ /**
17
+ * The Developer Gateway API ID being consumed
18
+ */
19
+ apiId: string;
20
+ /**
21
+ * Optional metric name (default: 'units')
22
+ */
23
+ metric?: string | undefined;
24
+ /**
25
+ * Amount of usage to log
26
+ */
27
+ units: number;
28
+ };
29
+
30
+ /**
31
+ * Usage logged successfully
32
+ */
33
+ export type GatewayBillingLogResponseBody = {
34
+ success?: boolean | undefined;
35
+ loggedUnits?: number | undefined;
36
+ };
37
+
38
+ export type GatewayBillingLogResponse =
39
+ | shared.ErrorResponse
40
+ | GatewayBillingLogResponseBody;
41
+
42
+ /** @internal */
43
+ export type GatewayBillingLogRequestBody$Outbound = {
44
+ consumerId: string;
45
+ apiId: string;
46
+ metric?: string | undefined;
47
+ units: number;
48
+ };
49
+
50
+ /** @internal */
51
+ export const GatewayBillingLogRequestBody$outboundSchema: z.ZodType<
52
+ GatewayBillingLogRequestBody$Outbound,
53
+ z.ZodTypeDef,
54
+ GatewayBillingLogRequestBody
55
+ > = z.object({
56
+ consumerId: z.string(),
57
+ apiId: z.string(),
58
+ metric: z.string().optional(),
59
+ units: z.number().int(),
60
+ });
61
+
62
+ export function gatewayBillingLogRequestBodyToJSON(
63
+ gatewayBillingLogRequestBody: GatewayBillingLogRequestBody,
64
+ ): string {
65
+ return JSON.stringify(
66
+ GatewayBillingLogRequestBody$outboundSchema.parse(
67
+ gatewayBillingLogRequestBody,
68
+ ),
69
+ );
70
+ }
71
+
72
+ /** @internal */
73
+ export const GatewayBillingLogResponseBody$inboundSchema: z.ZodType<
74
+ GatewayBillingLogResponseBody,
75
+ z.ZodTypeDef,
76
+ unknown
77
+ > = z.object({
78
+ success: z.boolean().optional(),
79
+ loggedUnits: z.number().int().optional(),
80
+ });
81
+
82
+ export function gatewayBillingLogResponseBodyFromJSON(
83
+ jsonString: string,
84
+ ): SafeParseResult<GatewayBillingLogResponseBody, SDKValidationError> {
85
+ return safeParse(
86
+ jsonString,
87
+ (x) => GatewayBillingLogResponseBody$inboundSchema.parse(JSON.parse(x)),
88
+ `Failed to parse 'GatewayBillingLogResponseBody' from JSON`,
89
+ );
90
+ }
91
+
92
+ /** @internal */
93
+ export const GatewayBillingLogResponse$inboundSchema: z.ZodType<
94
+ GatewayBillingLogResponse,
95
+ z.ZodTypeDef,
96
+ unknown
97
+ > = z.union([
98
+ shared.ErrorResponse$inboundSchema,
99
+ z.lazy(() => GatewayBillingLogResponseBody$inboundSchema),
100
+ ]);
101
+
102
+ export function gatewayBillingLogResponseFromJSON(
103
+ jsonString: string,
104
+ ): SafeParseResult<GatewayBillingLogResponse, SDKValidationError> {
105
+ return safeParse(
106
+ jsonString,
107
+ (x) => GatewayBillingLogResponse$inboundSchema.parse(JSON.parse(x)),
108
+ `Failed to parse 'GatewayBillingLogResponse' from JSON`,
109
+ );
110
+ }
@@ -11,6 +11,7 @@ export * from "./configure.js";
11
11
  export * from "./dbquery.js";
12
12
  export * from "./delete.js";
13
13
  export * from "./deletebytype.js";
14
+ export * from "./gatewaybillinglog.js";
14
15
  export * from "./ingest.js";
15
16
  export * from "./listtypes.js";
16
17
  export * from "./query.js";
package/src/sdk/sdk.ts CHANGED
@@ -7,6 +7,7 @@ import { Ai } from "./ai.js";
7
7
  import { Authentication } from "./authentication.js";
8
8
  import { Cache } from "./cache.js";
9
9
  import { Database } from "./database.js";
10
+ import { Gateway } from "./gateway.js";
10
11
  import { Queue } from "./queue.js";
11
12
  import { Services } from "./services.js";
12
13
  import { Storage } from "./storage.js";
@@ -46,4 +47,9 @@ export class SDK extends ClientSDK {
46
47
  get services(): Services {
47
48
  return (this._services ??= new Services(this._options));
48
49
  }
50
+
51
+ private _gateway?: Gateway;
52
+ get gateway(): Gateway {
53
+ return (this._gateway ??= new Gateway(this._options));
54
+ }
49
55
  }