@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.
- package/README.md +5 -0
- package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.d.ts +17 -0
- package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.d.ts.map +1 -0
- package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.js +114 -0
- package/dist/commonjs/funcs/gatewayBillingGatewayBillingLog.js.map +1 -0
- package/dist/commonjs/hooks/registration.d.ts +5 -0
- package/dist/commonjs/hooks/registration.d.ts.map +1 -1
- package/dist/commonjs/hooks/registration.js +18 -8
- package/dist/commonjs/hooks/registration.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/sdk/billing.d.ts +12 -0
- package/dist/commonjs/sdk/billing.d.ts.map +1 -0
- package/dist/commonjs/sdk/billing.js +22 -0
- package/dist/commonjs/sdk/billing.js.map +1 -0
- package/dist/commonjs/sdk/gateway.d.ts +7 -0
- package/dist/commonjs/sdk/gateway.d.ts.map +1 -0
- package/dist/commonjs/sdk/gateway.js +15 -0
- package/dist/commonjs/sdk/gateway.js.map +1 -0
- package/dist/commonjs/sdk/models/operations/gatewaybillinglog.d.ts +47 -0
- package/dist/commonjs/sdk/models/operations/gatewaybillinglog.d.ts.map +1 -0
- package/dist/commonjs/sdk/models/operations/gatewaybillinglog.js +72 -0
- package/dist/commonjs/sdk/models/operations/gatewaybillinglog.js.map +1 -0
- package/dist/commonjs/sdk/models/operations/index.d.ts +1 -0
- package/dist/commonjs/sdk/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/operations/index.js +1 -0
- package/dist/commonjs/sdk/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/gatewayBillingGatewayBillingLog.d.ts +17 -0
- package/dist/esm/funcs/gatewayBillingGatewayBillingLog.d.ts.map +1 -0
- package/dist/esm/funcs/gatewayBillingGatewayBillingLog.js +78 -0
- package/dist/esm/funcs/gatewayBillingGatewayBillingLog.js.map +1 -0
- package/dist/esm/hooks/registration.d.ts +5 -0
- package/dist/esm/hooks/registration.d.ts.map +1 -1
- package/dist/esm/hooks/registration.js +17 -8
- package/dist/esm/hooks/registration.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/sdk/billing.d.ts +12 -0
- package/dist/esm/sdk/billing.d.ts.map +1 -0
- package/dist/esm/sdk/billing.js +18 -0
- package/dist/esm/sdk/billing.js.map +1 -0
- package/dist/esm/sdk/gateway.d.ts +7 -0
- package/dist/esm/sdk/gateway.d.ts.map +1 -0
- package/dist/esm/sdk/gateway.js +11 -0
- package/dist/esm/sdk/gateway.js.map +1 -0
- package/dist/esm/sdk/models/operations/gatewaybillinglog.d.ts +47 -0
- package/dist/esm/sdk/models/operations/gatewaybillinglog.d.ts.map +1 -0
- package/dist/esm/sdk/models/operations/gatewaybillinglog.js +33 -0
- package/dist/esm/sdk/models/operations/gatewaybillinglog.js.map +1 -0
- package/dist/esm/sdk/models/operations/index.d.ts +1 -0
- package/dist/esm/sdk/models/operations/index.d.ts.map +1 -1
- package/dist/esm/sdk/models/operations/index.js +1 -0
- package/dist/esm/sdk/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +5 -3
- package/src/funcs/gatewayBillingGatewayBillingLog.ts +160 -0
- package/src/hooks/registration.ts +20 -9
- package/src/lib/config.ts +2 -2
- package/src/sdk/billing.ts +27 -0
- package/src/sdk/gateway.ts +13 -0
- package/src/sdk/models/operations/gatewaybillinglog.ts +110 -0
- package/src/sdk/models/operations/index.ts +1 -0
- 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.
|
|
68
|
+
sdkVersion: "0.3.3",
|
|
69
69
|
genVersion: "2.823.4",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.3.
|
|
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
|
}
|