@steamsets/client-ts 0.34.2 → 0.34.4
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 +7 -1
- package/funcs/accountSubscribe.d.ts +15 -0
- package/funcs/accountSubscribe.d.ts.map +1 -0
- package/funcs/accountSubscribe.js +136 -0
- package/funcs/accountSubscribe.js.map +1 -0
- package/funcs/statsSubscribe.d.ts +20 -0
- package/funcs/statsSubscribe.d.ts.map +1 -0
- package/funcs/statsSubscribe.js +128 -0
- package/funcs/statsSubscribe.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/models/components/eventaccountupdateddata.d.ts +11 -0
- package/models/components/eventaccountupdateddata.d.ts.map +1 -0
- package/models/components/eventaccountupdateddata.js +51 -0
- package/models/components/eventaccountupdateddata.js.map +1 -0
- package/models/components/eventaccountviewtickdata.d.ts +11 -0
- package/models/components/eventaccountviewtickdata.d.ts.map +1 -0
- package/models/components/eventaccountviewtickdata.js +51 -0
- package/models/components/eventaccountviewtickdata.js.map +1 -0
- package/models/components/eventstatsheartbeatdata.d.ts +10 -0
- package/models/components/eventstatsheartbeatdata.d.ts.map +1 -0
- package/models/components/eventstatsheartbeatdata.js +50 -0
- package/models/components/eventstatsheartbeatdata.js.map +1 -0
- package/models/components/eventstatsupdateddata.d.ts +13 -0
- package/models/components/eventstatsupdateddata.d.ts.map +1 -0
- package/models/components/eventstatsupdateddata.js +51 -0
- package/models/components/eventstatsupdateddata.js.map +1 -0
- package/models/components/heartbeat.d.ts +10 -0
- package/models/components/heartbeat.d.ts.map +1 -0
- package/models/components/heartbeat.js +50 -0
- package/models/components/heartbeat.js.map +1 -0
- package/models/components/index.d.ts +5 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +5 -0
- package/models/components/index.js.map +1 -1
- package/models/operations/accountsubscribe.d.ts +90 -0
- package/models/operations/accountsubscribe.d.ts.map +1 -0
- package/models/operations/accountsubscribe.js +146 -0
- package/models/operations/accountsubscribe.js.map +1 -0
- package/models/operations/badgepricingsubscribe.d.ts +5 -5
- package/models/operations/badgepricingsubscribe.d.ts.map +1 -1
- package/models/operations/badgepricingsubscribe.js +7 -7
- package/models/operations/badgepricingsubscribe.js.map +1 -1
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/statssubscribe.d.ts +81 -0
- package/models/operations/statssubscribe.d.ts.map +1 -0
- package/models/operations/statssubscribe.js +140 -0
- package/models/operations/statssubscribe.js.map +1 -0
- package/package.json +1 -1
- package/sdk/account.d.ts +4 -0
- package/sdk/account.d.ts.map +1 -1
- package/sdk/account.js +7 -0
- package/sdk/account.js.map +1 -1
- package/sdk/stats.d.ts +8 -0
- package/sdk/stats.d.ts.map +1 -1
- package/sdk/stats.js +10 -1
- package/sdk/stats.js.map +1 -1
- package/src/funcs/accountSubscribe.ts +190 -0
- package/src/funcs/statsSubscribe.ts +168 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/eventaccountupdateddata.ts +33 -0
- package/src/models/components/eventaccountviewtickdata.ts +33 -0
- package/src/models/components/eventstatsheartbeatdata.ts +31 -0
- package/src/models/components/eventstatsupdateddata.ts +33 -0
- package/src/models/components/heartbeat.ts +31 -0
- package/src/models/components/index.ts +5 -0
- package/src/models/operations/accountsubscribe.ts +251 -0
- package/src/models/operations/badgepricingsubscribe.ts +11 -11
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/statssubscribe.ts +228 -0
- package/src/sdk/account.ts +15 -0
- package/src/sdk/stats.ts +18 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SteamSetsCore } from "../core.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 { RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import {
|
|
13
|
+
ConnectionError,
|
|
14
|
+
InvalidRequestError,
|
|
15
|
+
RequestAbortedError,
|
|
16
|
+
RequestTimeoutError,
|
|
17
|
+
UnexpectedClientError,
|
|
18
|
+
} from "../models/errors/httpclienterrors.js";
|
|
19
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
20
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
21
|
+
import { SteamSetsError } from "../models/errors/steamsetserror.js";
|
|
22
|
+
import * as operations from "../models/operations/index.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
export enum SubscribeAcceptEnum {
|
|
27
|
+
applicationProblemPlusJson = "application/problem+json",
|
|
28
|
+
textEventStream = "text/event-stream",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Server-sent-events stream of platform stats. Emits a snapshot, then deltas as the queues commit them.
|
|
33
|
+
*/
|
|
34
|
+
export function statsSubscribe(
|
|
35
|
+
client: SteamSetsCore,
|
|
36
|
+
options?: RequestOptions & { acceptHeaderOverride?: SubscribeAcceptEnum },
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
operations.StatsSubscribeResponse,
|
|
40
|
+
| SteamSetsError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
options,
|
|
53
|
+
));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function $do(
|
|
57
|
+
client: SteamSetsCore,
|
|
58
|
+
options?: RequestOptions & { acceptHeaderOverride?: SubscribeAcceptEnum },
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
operations.StatsSubscribeResponse,
|
|
63
|
+
| SteamSetsError
|
|
64
|
+
| ResponseValidationError
|
|
65
|
+
| ConnectionError
|
|
66
|
+
| RequestAbortedError
|
|
67
|
+
| RequestTimeoutError
|
|
68
|
+
| InvalidRequestError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| SDKValidationError
|
|
71
|
+
>,
|
|
72
|
+
APICall,
|
|
73
|
+
]
|
|
74
|
+
> {
|
|
75
|
+
const path = pathToFunc("/v1/stats.subscribe")();
|
|
76
|
+
|
|
77
|
+
const headers = new Headers(compactMap({
|
|
78
|
+
Accept: options?.acceptHeaderOverride
|
|
79
|
+
|| "application/problem+json;q=1, text/event-stream;q=0",
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const secConfig = await extractSecurity(client._options.token);
|
|
83
|
+
const securityInput = secConfig == null ? {} : { token: secConfig };
|
|
84
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
85
|
+
|
|
86
|
+
const context = {
|
|
87
|
+
options: client._options,
|
|
88
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
89
|
+
operationID: "stats.subscribe",
|
|
90
|
+
oAuth2Scopes: null,
|
|
91
|
+
|
|
92
|
+
resolvedSecurity: requestSecurity,
|
|
93
|
+
|
|
94
|
+
securitySource: client._options.token,
|
|
95
|
+
retryConfig: options?.retries
|
|
96
|
+
|| client._options.retryConfig
|
|
97
|
+
|| {
|
|
98
|
+
strategy: "backoff",
|
|
99
|
+
backoff: {
|
|
100
|
+
initialInterval: 500,
|
|
101
|
+
maxInterval: 5000,
|
|
102
|
+
exponent: 1.5,
|
|
103
|
+
maxElapsedTime: 60000,
|
|
104
|
+
},
|
|
105
|
+
retryConnectionErrors: true,
|
|
106
|
+
}
|
|
107
|
+
|| { strategy: "none" },
|
|
108
|
+
retryCodes: options?.retryCodes || ["501", "502", "503", "504"],
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const requestRes = client._createRequest(context, {
|
|
112
|
+
security: requestSecurity,
|
|
113
|
+
method: "GET",
|
|
114
|
+
baseURL: options?.serverURL,
|
|
115
|
+
path: path,
|
|
116
|
+
headers: headers,
|
|
117
|
+
uaHeader: "x-speakeasy-user-agent",
|
|
118
|
+
userAgent: client._options.userAgent,
|
|
119
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
120
|
+
}, options);
|
|
121
|
+
if (!requestRes.ok) {
|
|
122
|
+
return [requestRes, { status: "invalid" }];
|
|
123
|
+
}
|
|
124
|
+
const req = requestRes.value;
|
|
125
|
+
|
|
126
|
+
const doResult = await client._do(req, {
|
|
127
|
+
context,
|
|
128
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
129
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
130
|
+
retryConfig: context.retryConfig,
|
|
131
|
+
retryCodes: context.retryCodes,
|
|
132
|
+
});
|
|
133
|
+
if (!doResult.ok) {
|
|
134
|
+
return [doResult, { status: "request-error", request: req }];
|
|
135
|
+
}
|
|
136
|
+
const response = doResult.value;
|
|
137
|
+
|
|
138
|
+
const responseFields = {
|
|
139
|
+
HttpMeta: { Response: response, Request: req },
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const [result] = await M.match<
|
|
143
|
+
operations.StatsSubscribeResponse,
|
|
144
|
+
| SteamSetsError
|
|
145
|
+
| ResponseValidationError
|
|
146
|
+
| ConnectionError
|
|
147
|
+
| RequestAbortedError
|
|
148
|
+
| RequestTimeoutError
|
|
149
|
+
| InvalidRequestError
|
|
150
|
+
| UnexpectedClientError
|
|
151
|
+
| SDKValidationError
|
|
152
|
+
>(
|
|
153
|
+
M.sse(200, operations.StatsSubscribeResponse$inboundSchema, {
|
|
154
|
+
key: "Server Sent Events",
|
|
155
|
+
}),
|
|
156
|
+
M.fail("4XX"),
|
|
157
|
+
M.fail("5XX"),
|
|
158
|
+
M.json("default", operations.StatsSubscribeResponse$inboundSchema, {
|
|
159
|
+
ctype: "application/problem+json",
|
|
160
|
+
key: "ErrorModel",
|
|
161
|
+
}),
|
|
162
|
+
)(response, req, { extraFields: responseFields });
|
|
163
|
+
if (!result.ok) {
|
|
164
|
+
return [result, { status: "complete", request: req, response }];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return [result, { status: "complete", request: req, response }];
|
|
168
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -59,8 +59,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
59
59
|
export const SDK_METADATA = {
|
|
60
60
|
language: "typescript",
|
|
61
61
|
openapiDocVersion: "1.0.0",
|
|
62
|
-
sdkVersion: "0.34.
|
|
63
|
-
genVersion: "2.
|
|
62
|
+
sdkVersion: "0.34.4",
|
|
63
|
+
genVersion: "2.882.0",
|
|
64
64
|
userAgent:
|
|
65
|
-
"speakeasy-sdk/typescript 0.34.
|
|
65
|
+
"speakeasy-sdk/typescript 0.34.4 2.882.0 1.0.0 @steamsets/client-ts",
|
|
66
66
|
} as const;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
10
|
+
export type EventAccountUpdatedData = {
|
|
11
|
+
accountId: number;
|
|
12
|
+
status: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const EventAccountUpdatedData$inboundSchema: z.ZodType<
|
|
17
|
+
EventAccountUpdatedData,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
accountId: z.number().int(),
|
|
22
|
+
status: z.string(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function eventAccountUpdatedDataFromJSON(
|
|
26
|
+
jsonString: string,
|
|
27
|
+
): SafeParseResult<EventAccountUpdatedData, SDKValidationError> {
|
|
28
|
+
return safeParse(
|
|
29
|
+
jsonString,
|
|
30
|
+
(x) => EventAccountUpdatedData$inboundSchema.parse(JSON.parse(x)),
|
|
31
|
+
`Failed to parse 'EventAccountUpdatedData' from JSON`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
10
|
+
export type EventAccountViewTickData = {
|
|
11
|
+
accountId: number;
|
|
12
|
+
totalDelta: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const EventAccountViewTickData$inboundSchema: z.ZodType<
|
|
17
|
+
EventAccountViewTickData,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
accountId: z.number().int(),
|
|
22
|
+
totalDelta: z.number().int(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function eventAccountViewTickDataFromJSON(
|
|
26
|
+
jsonString: string,
|
|
27
|
+
): SafeParseResult<EventAccountViewTickData, SDKValidationError> {
|
|
28
|
+
return safeParse(
|
|
29
|
+
jsonString,
|
|
30
|
+
(x) => EventAccountViewTickData$inboundSchema.parse(JSON.parse(x)),
|
|
31
|
+
`Failed to parse 'EventAccountViewTickData' from JSON`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
|
|
10
|
+
export type EventStatsHeartbeatData = {
|
|
11
|
+
heartbeat: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const EventStatsHeartbeatData$inboundSchema: z.ZodType<
|
|
16
|
+
EventStatsHeartbeatData,
|
|
17
|
+
z.ZodTypeDef,
|
|
18
|
+
unknown
|
|
19
|
+
> = z.object({
|
|
20
|
+
heartbeat: z.number().int(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export function eventStatsHeartbeatDataFromJSON(
|
|
24
|
+
jsonString: string,
|
|
25
|
+
): SafeParseResult<EventStatsHeartbeatData, SDKValidationError> {
|
|
26
|
+
return safeParse(
|
|
27
|
+
jsonString,
|
|
28
|
+
(x) => EventStatsHeartbeatData$inboundSchema.parse(JSON.parse(x)),
|
|
29
|
+
`Failed to parse 'EventStatsHeartbeatData' from JSON`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
10
|
+
export type EventStatsUpdatedData = {
|
|
11
|
+
date: string;
|
|
12
|
+
deltas: { [k: string]: number };
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const EventStatsUpdatedData$inboundSchema: z.ZodType<
|
|
17
|
+
EventStatsUpdatedData,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
date: z.string(),
|
|
22
|
+
deltas: z.record(z.number().int()),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function eventStatsUpdatedDataFromJSON(
|
|
26
|
+
jsonString: string,
|
|
27
|
+
): SafeParseResult<EventStatsUpdatedData, SDKValidationError> {
|
|
28
|
+
return safeParse(
|
|
29
|
+
jsonString,
|
|
30
|
+
(x) => EventStatsUpdatedData$inboundSchema.parse(JSON.parse(x)),
|
|
31
|
+
`Failed to parse 'EventStatsUpdatedData' from JSON`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
|
|
10
|
+
export type Heartbeat = {
|
|
11
|
+
heartbeat: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const Heartbeat$inboundSchema: z.ZodType<
|
|
16
|
+
Heartbeat,
|
|
17
|
+
z.ZodTypeDef,
|
|
18
|
+
unknown
|
|
19
|
+
> = z.object({
|
|
20
|
+
heartbeat: z.number().int(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export function heartbeatFromJSON(
|
|
24
|
+
jsonString: string,
|
|
25
|
+
): SafeParseResult<Heartbeat, SDKValidationError> {
|
|
26
|
+
return safeParse(
|
|
27
|
+
jsonString,
|
|
28
|
+
(x) => Heartbeat$inboundSchema.parse(JSON.parse(x)),
|
|
29
|
+
`Failed to parse 'Heartbeat' from JSON`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -41,10 +41,15 @@ export * from "./developerappanalyticstimeseries.js";
|
|
|
41
41
|
export * from "./developerappanalyticstimeseriespoint.js";
|
|
42
42
|
export * from "./errordetail.js";
|
|
43
43
|
export * from "./errormodel.js";
|
|
44
|
+
export * from "./eventaccountupdateddata.js";
|
|
45
|
+
export * from "./eventaccountviewtickdata.js";
|
|
44
46
|
export * from "./eventmarketpricetickdata.js";
|
|
47
|
+
export * from "./eventstatsheartbeatdata.js";
|
|
48
|
+
export * from "./eventstatsupdateddata.js";
|
|
45
49
|
export * from "./findownersrequestbody.js";
|
|
46
50
|
export * from "./findownersresponsebody.js";
|
|
47
51
|
export * from "./friendpath.js";
|
|
52
|
+
export * from "./heartbeat.js";
|
|
48
53
|
export * from "./historyvalue.js";
|
|
49
54
|
export * from "./httpmetadata.js";
|
|
50
55
|
export * from "./idsearch.js";
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { EventStream } from "../../lib/event-streams.js";
|
|
7
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import * as components from "../components/index.js";
|
|
11
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
+
|
|
13
|
+
export type AccountSubscribeRequest = {
|
|
14
|
+
/**
|
|
15
|
+
* Account ID to subscribe to
|
|
16
|
+
*/
|
|
17
|
+
accountId: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type EventHeartbeat = {
|
|
21
|
+
data: components.Heartbeat;
|
|
22
|
+
/**
|
|
23
|
+
* The event name.
|
|
24
|
+
*/
|
|
25
|
+
event: "heartbeat";
|
|
26
|
+
/**
|
|
27
|
+
* The event ID.
|
|
28
|
+
*/
|
|
29
|
+
id?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The retry time in milliseconds.
|
|
32
|
+
*/
|
|
33
|
+
retry?: number | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type EventAccountViewTick = {
|
|
37
|
+
data: components.EventAccountViewTickData;
|
|
38
|
+
/**
|
|
39
|
+
* The event name.
|
|
40
|
+
*/
|
|
41
|
+
event: "account-view-tick";
|
|
42
|
+
/**
|
|
43
|
+
* The event ID.
|
|
44
|
+
*/
|
|
45
|
+
id?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The retry time in milliseconds.
|
|
48
|
+
*/
|
|
49
|
+
retry?: number | undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type EventAccountUpdated = {
|
|
53
|
+
data: components.EventAccountUpdatedData;
|
|
54
|
+
/**
|
|
55
|
+
* The event name.
|
|
56
|
+
*/
|
|
57
|
+
event: "account-updated";
|
|
58
|
+
/**
|
|
59
|
+
* The event ID.
|
|
60
|
+
*/
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The retry time in milliseconds.
|
|
64
|
+
*/
|
|
65
|
+
retry?: number | undefined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Each oneOf object in the array represents one possible Server Sent Events (SSE) message, serialized as UTF-8 text according to the SSE specification.
|
|
70
|
+
*/
|
|
71
|
+
export type AccountSubscribeServerSentEvents =
|
|
72
|
+
| EventAccountUpdated
|
|
73
|
+
| EventAccountViewTick
|
|
74
|
+
| EventHeartbeat;
|
|
75
|
+
|
|
76
|
+
export type AccountSubscribeResponse = {
|
|
77
|
+
httpMeta: components.HTTPMetadata;
|
|
78
|
+
/**
|
|
79
|
+
* OK
|
|
80
|
+
*/
|
|
81
|
+
serverSentEvents?:
|
|
82
|
+
| EventStream<EventAccountUpdated | EventAccountViewTick | EventHeartbeat>
|
|
83
|
+
| undefined;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export type AccountSubscribeRequest$Outbound = {
|
|
88
|
+
accountId: number;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export const AccountSubscribeRequest$outboundSchema: z.ZodType<
|
|
93
|
+
AccountSubscribeRequest$Outbound,
|
|
94
|
+
z.ZodTypeDef,
|
|
95
|
+
AccountSubscribeRequest
|
|
96
|
+
> = z.object({
|
|
97
|
+
accountId: z.number().int(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export function accountSubscribeRequestToJSON(
|
|
101
|
+
accountSubscribeRequest: AccountSubscribeRequest,
|
|
102
|
+
): string {
|
|
103
|
+
return JSON.stringify(
|
|
104
|
+
AccountSubscribeRequest$outboundSchema.parse(accountSubscribeRequest),
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @internal */
|
|
109
|
+
export const EventHeartbeat$inboundSchema: z.ZodType<
|
|
110
|
+
EventHeartbeat,
|
|
111
|
+
z.ZodTypeDef,
|
|
112
|
+
unknown
|
|
113
|
+
> = z.object({
|
|
114
|
+
data: z.string().transform((v, ctx) => {
|
|
115
|
+
try {
|
|
116
|
+
return JSON.parse(v);
|
|
117
|
+
} catch (err) {
|
|
118
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
119
|
+
return z.NEVER;
|
|
120
|
+
}
|
|
121
|
+
}).pipe(components.Heartbeat$inboundSchema),
|
|
122
|
+
event: z.literal("heartbeat"),
|
|
123
|
+
id: z.string().optional(),
|
|
124
|
+
retry: z.number().int().optional(),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export function eventHeartbeatFromJSON(
|
|
128
|
+
jsonString: string,
|
|
129
|
+
): SafeParseResult<EventHeartbeat, SDKValidationError> {
|
|
130
|
+
return safeParse(
|
|
131
|
+
jsonString,
|
|
132
|
+
(x) => EventHeartbeat$inboundSchema.parse(JSON.parse(x)),
|
|
133
|
+
`Failed to parse 'EventHeartbeat' from JSON`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** @internal */
|
|
138
|
+
export const EventAccountViewTick$inboundSchema: z.ZodType<
|
|
139
|
+
EventAccountViewTick,
|
|
140
|
+
z.ZodTypeDef,
|
|
141
|
+
unknown
|
|
142
|
+
> = z.object({
|
|
143
|
+
data: z.string().transform((v, ctx) => {
|
|
144
|
+
try {
|
|
145
|
+
return JSON.parse(v);
|
|
146
|
+
} catch (err) {
|
|
147
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
148
|
+
return z.NEVER;
|
|
149
|
+
}
|
|
150
|
+
}).pipe(components.EventAccountViewTickData$inboundSchema),
|
|
151
|
+
event: z.literal("account-view-tick"),
|
|
152
|
+
id: z.string().optional(),
|
|
153
|
+
retry: z.number().int().optional(),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export function eventAccountViewTickFromJSON(
|
|
157
|
+
jsonString: string,
|
|
158
|
+
): SafeParseResult<EventAccountViewTick, SDKValidationError> {
|
|
159
|
+
return safeParse(
|
|
160
|
+
jsonString,
|
|
161
|
+
(x) => EventAccountViewTick$inboundSchema.parse(JSON.parse(x)),
|
|
162
|
+
`Failed to parse 'EventAccountViewTick' from JSON`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** @internal */
|
|
167
|
+
export const EventAccountUpdated$inboundSchema: z.ZodType<
|
|
168
|
+
EventAccountUpdated,
|
|
169
|
+
z.ZodTypeDef,
|
|
170
|
+
unknown
|
|
171
|
+
> = z.object({
|
|
172
|
+
data: z.string().transform((v, ctx) => {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.parse(v);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
177
|
+
return z.NEVER;
|
|
178
|
+
}
|
|
179
|
+
}).pipe(components.EventAccountUpdatedData$inboundSchema),
|
|
180
|
+
event: z.literal("account-updated"),
|
|
181
|
+
id: z.string().optional(),
|
|
182
|
+
retry: z.number().int().optional(),
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
export function eventAccountUpdatedFromJSON(
|
|
186
|
+
jsonString: string,
|
|
187
|
+
): SafeParseResult<EventAccountUpdated, SDKValidationError> {
|
|
188
|
+
return safeParse(
|
|
189
|
+
jsonString,
|
|
190
|
+
(x) => EventAccountUpdated$inboundSchema.parse(JSON.parse(x)),
|
|
191
|
+
`Failed to parse 'EventAccountUpdated' from JSON`,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** @internal */
|
|
196
|
+
export const AccountSubscribeServerSentEvents$inboundSchema: z.ZodType<
|
|
197
|
+
AccountSubscribeServerSentEvents,
|
|
198
|
+
z.ZodTypeDef,
|
|
199
|
+
unknown
|
|
200
|
+
> = z.union([
|
|
201
|
+
z.lazy(() => EventAccountUpdated$inboundSchema),
|
|
202
|
+
z.lazy(() => EventAccountViewTick$inboundSchema),
|
|
203
|
+
z.lazy(() => EventHeartbeat$inboundSchema),
|
|
204
|
+
]);
|
|
205
|
+
|
|
206
|
+
export function accountSubscribeServerSentEventsFromJSON(
|
|
207
|
+
jsonString: string,
|
|
208
|
+
): SafeParseResult<AccountSubscribeServerSentEvents, SDKValidationError> {
|
|
209
|
+
return safeParse(
|
|
210
|
+
jsonString,
|
|
211
|
+
(x) => AccountSubscribeServerSentEvents$inboundSchema.parse(JSON.parse(x)),
|
|
212
|
+
`Failed to parse 'AccountSubscribeServerSentEvents' from JSON`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** @internal */
|
|
217
|
+
export const AccountSubscribeResponse$inboundSchema: z.ZodType<
|
|
218
|
+
AccountSubscribeResponse,
|
|
219
|
+
z.ZodTypeDef,
|
|
220
|
+
unknown
|
|
221
|
+
> = z.object({
|
|
222
|
+
HttpMeta: components.HTTPMetadata$inboundSchema,
|
|
223
|
+
"Server Sent Events": z.instanceof(ReadableStream<Uint8Array>)
|
|
224
|
+
.transform(stream => {
|
|
225
|
+
return new EventStream(stream, rawEvent => {
|
|
226
|
+
return {
|
|
227
|
+
done: false,
|
|
228
|
+
value: z.union([
|
|
229
|
+
z.lazy(() => EventAccountUpdated$inboundSchema),
|
|
230
|
+
z.lazy(() => EventAccountViewTick$inboundSchema),
|
|
231
|
+
z.lazy(() => EventHeartbeat$inboundSchema),
|
|
232
|
+
]).parse(rawEvent),
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}).optional(),
|
|
236
|
+
}).transform((v) => {
|
|
237
|
+
return remap$(v, {
|
|
238
|
+
"HttpMeta": "httpMeta",
|
|
239
|
+
"Server Sent Events": "serverSentEvents",
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export function accountSubscribeResponseFromJSON(
|
|
244
|
+
jsonString: string,
|
|
245
|
+
): SafeParseResult<AccountSubscribeResponse, SDKValidationError> {
|
|
246
|
+
return safeParse(
|
|
247
|
+
jsonString,
|
|
248
|
+
(x) => AccountSubscribeResponse$inboundSchema.parse(JSON.parse(x)),
|
|
249
|
+
`Failed to parse 'AccountSubscribeResponse' from JSON`,
|
|
250
|
+
);
|
|
251
|
+
}
|
|
@@ -26,7 +26,7 @@ export type EventMarketPriceTick = {
|
|
|
26
26
|
retry?: number | undefined;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export type
|
|
29
|
+
export type ServerSentEventsEventHeartbeat = {
|
|
30
30
|
data: components.PricingHeartbeat;
|
|
31
31
|
/**
|
|
32
32
|
* The event name.
|
|
@@ -46,7 +46,7 @@ export type EventHeartbeat = {
|
|
|
46
46
|
* Each oneOf object in the array represents one possible Server Sent Events (SSE) message, serialized as UTF-8 text according to the SSE specification.
|
|
47
47
|
*/
|
|
48
48
|
export type BadgePricingSubscribeServerSentEvents =
|
|
49
|
-
|
|
|
49
|
+
| ServerSentEventsEventHeartbeat
|
|
50
50
|
| EventMarketPriceTick;
|
|
51
51
|
|
|
52
52
|
export type BadgePricingSubscribeResponse = {
|
|
@@ -55,7 +55,7 @@ export type BadgePricingSubscribeResponse = {
|
|
|
55
55
|
* OK
|
|
56
56
|
*/
|
|
57
57
|
serverSentEvents?:
|
|
58
|
-
| EventStream<
|
|
58
|
+
| EventStream<ServerSentEventsEventHeartbeat | EventMarketPriceTick>
|
|
59
59
|
| undefined;
|
|
60
60
|
/**
|
|
61
61
|
* Error
|
|
@@ -93,8 +93,8 @@ export function eventMarketPriceTickFromJSON(
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/** @internal */
|
|
96
|
-
export const
|
|
97
|
-
|
|
96
|
+
export const ServerSentEventsEventHeartbeat$inboundSchema: z.ZodType<
|
|
97
|
+
ServerSentEventsEventHeartbeat,
|
|
98
98
|
z.ZodTypeDef,
|
|
99
99
|
unknown
|
|
100
100
|
> = z.object({
|
|
@@ -111,13 +111,13 @@ export const EventHeartbeat$inboundSchema: z.ZodType<
|
|
|
111
111
|
retry: z.number().int().optional(),
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
export function
|
|
114
|
+
export function serverSentEventsEventHeartbeatFromJSON(
|
|
115
115
|
jsonString: string,
|
|
116
|
-
): SafeParseResult<
|
|
116
|
+
): SafeParseResult<ServerSentEventsEventHeartbeat, SDKValidationError> {
|
|
117
117
|
return safeParse(
|
|
118
118
|
jsonString,
|
|
119
|
-
(x) =>
|
|
120
|
-
`Failed to parse '
|
|
119
|
+
(x) => ServerSentEventsEventHeartbeat$inboundSchema.parse(JSON.parse(x)),
|
|
120
|
+
`Failed to parse 'ServerSentEventsEventHeartbeat' from JSON`,
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -127,7 +127,7 @@ export const BadgePricingSubscribeServerSentEvents$inboundSchema: z.ZodType<
|
|
|
127
127
|
z.ZodTypeDef,
|
|
128
128
|
unknown
|
|
129
129
|
> = z.union([
|
|
130
|
-
z.lazy(() =>
|
|
130
|
+
z.lazy(() => ServerSentEventsEventHeartbeat$inboundSchema),
|
|
131
131
|
z.lazy(() => EventMarketPriceTick$inboundSchema),
|
|
132
132
|
]);
|
|
133
133
|
|
|
@@ -155,7 +155,7 @@ export const BadgePricingSubscribeResponse$inboundSchema: z.ZodType<
|
|
|
155
155
|
return {
|
|
156
156
|
done: false,
|
|
157
157
|
value: z.union([
|
|
158
|
-
z.lazy(() =>
|
|
158
|
+
z.lazy(() => ServerSentEventsEventHeartbeat$inboundSchema),
|
|
159
159
|
z.lazy(() => EventMarketPriceTick$inboundSchema),
|
|
160
160
|
]).parse(rawEvent),
|
|
161
161
|
};
|