@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.
Files changed (77) hide show
  1. package/README.md +7 -1
  2. package/funcs/accountSubscribe.d.ts +15 -0
  3. package/funcs/accountSubscribe.d.ts.map +1 -0
  4. package/funcs/accountSubscribe.js +136 -0
  5. package/funcs/accountSubscribe.js.map +1 -0
  6. package/funcs/statsSubscribe.d.ts +20 -0
  7. package/funcs/statsSubscribe.d.ts.map +1 -0
  8. package/funcs/statsSubscribe.js +128 -0
  9. package/funcs/statsSubscribe.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/lib/config.js.map +1 -1
  14. package/models/components/eventaccountupdateddata.d.ts +11 -0
  15. package/models/components/eventaccountupdateddata.d.ts.map +1 -0
  16. package/models/components/eventaccountupdateddata.js +51 -0
  17. package/models/components/eventaccountupdateddata.js.map +1 -0
  18. package/models/components/eventaccountviewtickdata.d.ts +11 -0
  19. package/models/components/eventaccountviewtickdata.d.ts.map +1 -0
  20. package/models/components/eventaccountviewtickdata.js +51 -0
  21. package/models/components/eventaccountviewtickdata.js.map +1 -0
  22. package/models/components/eventstatsheartbeatdata.d.ts +10 -0
  23. package/models/components/eventstatsheartbeatdata.d.ts.map +1 -0
  24. package/models/components/eventstatsheartbeatdata.js +50 -0
  25. package/models/components/eventstatsheartbeatdata.js.map +1 -0
  26. package/models/components/eventstatsupdateddata.d.ts +13 -0
  27. package/models/components/eventstatsupdateddata.d.ts.map +1 -0
  28. package/models/components/eventstatsupdateddata.js +51 -0
  29. package/models/components/eventstatsupdateddata.js.map +1 -0
  30. package/models/components/heartbeat.d.ts +10 -0
  31. package/models/components/heartbeat.d.ts.map +1 -0
  32. package/models/components/heartbeat.js +50 -0
  33. package/models/components/heartbeat.js.map +1 -0
  34. package/models/components/index.d.ts +5 -0
  35. package/models/components/index.d.ts.map +1 -1
  36. package/models/components/index.js +5 -0
  37. package/models/components/index.js.map +1 -1
  38. package/models/operations/accountsubscribe.d.ts +90 -0
  39. package/models/operations/accountsubscribe.d.ts.map +1 -0
  40. package/models/operations/accountsubscribe.js +146 -0
  41. package/models/operations/accountsubscribe.js.map +1 -0
  42. package/models/operations/badgepricingsubscribe.d.ts +5 -5
  43. package/models/operations/badgepricingsubscribe.d.ts.map +1 -1
  44. package/models/operations/badgepricingsubscribe.js +7 -7
  45. package/models/operations/badgepricingsubscribe.js.map +1 -1
  46. package/models/operations/index.d.ts +2 -0
  47. package/models/operations/index.d.ts.map +1 -1
  48. package/models/operations/index.js +2 -0
  49. package/models/operations/index.js.map +1 -1
  50. package/models/operations/statssubscribe.d.ts +81 -0
  51. package/models/operations/statssubscribe.d.ts.map +1 -0
  52. package/models/operations/statssubscribe.js +140 -0
  53. package/models/operations/statssubscribe.js.map +1 -0
  54. package/package.json +1 -1
  55. package/sdk/account.d.ts +4 -0
  56. package/sdk/account.d.ts.map +1 -1
  57. package/sdk/account.js +7 -0
  58. package/sdk/account.js.map +1 -1
  59. package/sdk/stats.d.ts +8 -0
  60. package/sdk/stats.d.ts.map +1 -1
  61. package/sdk/stats.js +10 -1
  62. package/sdk/stats.js.map +1 -1
  63. package/src/funcs/accountSubscribe.ts +190 -0
  64. package/src/funcs/statsSubscribe.ts +168 -0
  65. package/src/lib/config.ts +3 -3
  66. package/src/models/components/eventaccountupdateddata.ts +33 -0
  67. package/src/models/components/eventaccountviewtickdata.ts +33 -0
  68. package/src/models/components/eventstatsheartbeatdata.ts +31 -0
  69. package/src/models/components/eventstatsupdateddata.ts +33 -0
  70. package/src/models/components/heartbeat.ts +31 -0
  71. package/src/models/components/index.ts +5 -0
  72. package/src/models/operations/accountsubscribe.ts +251 -0
  73. package/src/models/operations/badgepricingsubscribe.ts +11 -11
  74. package/src/models/operations/index.ts +2 -0
  75. package/src/models/operations/statssubscribe.ts +228 -0
  76. package/src/sdk/account.ts +15 -0
  77. package/src/sdk/stats.ts +18 -0
@@ -34,6 +34,7 @@ export * from "./accountreconnectconnection.js";
34
34
  export * from "./accountrefreshinventory.js";
35
35
  export * from "./accountrefreshsession.js";
36
36
  export * from "./accountsendemailverification.js";
37
+ export * from "./accountsubscribe.js";
37
38
  export * from "./accountsubscribeemail.js";
38
39
  export * from "./accountupdateconnection.js";
39
40
  export * from "./accountupdatedeveloperapp.js";
@@ -97,5 +98,6 @@ export * from "./maintenancelist.js";
97
98
  export * from "./searchgettrending.js";
98
99
  export * from "./staffliststaff.js";
99
100
  export * from "./statsgetstats.js";
101
+ export * from "./statssubscribe.js";
100
102
  export * from "./streamglobalfeed.js";
101
103
  export * from "./trackevent.js";
@@ -0,0 +1,228 @@
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 EventStatsUpdated = {
14
+ data: components.EventStatsUpdatedData;
15
+ /**
16
+ * The event name.
17
+ */
18
+ event: "stats-updated";
19
+ /**
20
+ * The event ID.
21
+ */
22
+ id?: string | undefined;
23
+ /**
24
+ * The retry time in milliseconds.
25
+ */
26
+ retry?: number | undefined;
27
+ };
28
+
29
+ export type EventStatsSnapshot = {
30
+ data: components.V1Stats;
31
+ /**
32
+ * The event name.
33
+ */
34
+ event: "stats-snapshot";
35
+ /**
36
+ * The event ID.
37
+ */
38
+ id?: string | undefined;
39
+ /**
40
+ * The retry time in milliseconds.
41
+ */
42
+ retry?: number | undefined;
43
+ };
44
+
45
+ export type EventStatsHeartbeat = {
46
+ data: components.EventStatsHeartbeatData;
47
+ /**
48
+ * The event name.
49
+ */
50
+ event: "stats-heartbeat";
51
+ /**
52
+ * The event ID.
53
+ */
54
+ id?: string | undefined;
55
+ /**
56
+ * The retry time in milliseconds.
57
+ */
58
+ retry?: number | undefined;
59
+ };
60
+
61
+ /**
62
+ * Each oneOf object in the array represents one possible Server Sent Events (SSE) message, serialized as UTF-8 text according to the SSE specification.
63
+ */
64
+ export type StatsSubscribeServerSentEvents =
65
+ | EventStatsHeartbeat
66
+ | EventStatsSnapshot
67
+ | EventStatsUpdated;
68
+
69
+ export type StatsSubscribeResponse = {
70
+ httpMeta: components.HTTPMetadata;
71
+ /**
72
+ * OK
73
+ */
74
+ serverSentEvents?:
75
+ | EventStream<EventStatsHeartbeat | EventStatsSnapshot | EventStatsUpdated>
76
+ | undefined;
77
+ /**
78
+ * Error
79
+ */
80
+ errorModel?: components.ErrorModel | undefined;
81
+ };
82
+
83
+ /** @internal */
84
+ export const EventStatsUpdated$inboundSchema: z.ZodType<
85
+ EventStatsUpdated,
86
+ z.ZodTypeDef,
87
+ unknown
88
+ > = z.object({
89
+ data: z.string().transform((v, ctx) => {
90
+ try {
91
+ return JSON.parse(v);
92
+ } catch (err) {
93
+ ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
94
+ return z.NEVER;
95
+ }
96
+ }).pipe(components.EventStatsUpdatedData$inboundSchema),
97
+ event: z.literal("stats-updated"),
98
+ id: z.string().optional(),
99
+ retry: z.number().int().optional(),
100
+ });
101
+
102
+ export function eventStatsUpdatedFromJSON(
103
+ jsonString: string,
104
+ ): SafeParseResult<EventStatsUpdated, SDKValidationError> {
105
+ return safeParse(
106
+ jsonString,
107
+ (x) => EventStatsUpdated$inboundSchema.parse(JSON.parse(x)),
108
+ `Failed to parse 'EventStatsUpdated' from JSON`,
109
+ );
110
+ }
111
+
112
+ /** @internal */
113
+ export const EventStatsSnapshot$inboundSchema: z.ZodType<
114
+ EventStatsSnapshot,
115
+ z.ZodTypeDef,
116
+ unknown
117
+ > = z.object({
118
+ data: z.string().transform((v, ctx) => {
119
+ try {
120
+ return JSON.parse(v);
121
+ } catch (err) {
122
+ ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
123
+ return z.NEVER;
124
+ }
125
+ }).pipe(components.V1Stats$inboundSchema),
126
+ event: z.literal("stats-snapshot"),
127
+ id: z.string().optional(),
128
+ retry: z.number().int().optional(),
129
+ });
130
+
131
+ export function eventStatsSnapshotFromJSON(
132
+ jsonString: string,
133
+ ): SafeParseResult<EventStatsSnapshot, SDKValidationError> {
134
+ return safeParse(
135
+ jsonString,
136
+ (x) => EventStatsSnapshot$inboundSchema.parse(JSON.parse(x)),
137
+ `Failed to parse 'EventStatsSnapshot' from JSON`,
138
+ );
139
+ }
140
+
141
+ /** @internal */
142
+ export const EventStatsHeartbeat$inboundSchema: z.ZodType<
143
+ EventStatsHeartbeat,
144
+ z.ZodTypeDef,
145
+ unknown
146
+ > = z.object({
147
+ data: z.string().transform((v, ctx) => {
148
+ try {
149
+ return JSON.parse(v);
150
+ } catch (err) {
151
+ ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
152
+ return z.NEVER;
153
+ }
154
+ }).pipe(components.EventStatsHeartbeatData$inboundSchema),
155
+ event: z.literal("stats-heartbeat"),
156
+ id: z.string().optional(),
157
+ retry: z.number().int().optional(),
158
+ });
159
+
160
+ export function eventStatsHeartbeatFromJSON(
161
+ jsonString: string,
162
+ ): SafeParseResult<EventStatsHeartbeat, SDKValidationError> {
163
+ return safeParse(
164
+ jsonString,
165
+ (x) => EventStatsHeartbeat$inboundSchema.parse(JSON.parse(x)),
166
+ `Failed to parse 'EventStatsHeartbeat' from JSON`,
167
+ );
168
+ }
169
+
170
+ /** @internal */
171
+ export const StatsSubscribeServerSentEvents$inboundSchema: z.ZodType<
172
+ StatsSubscribeServerSentEvents,
173
+ z.ZodTypeDef,
174
+ unknown
175
+ > = z.union([
176
+ z.lazy(() => EventStatsHeartbeat$inboundSchema),
177
+ z.lazy(() => EventStatsSnapshot$inboundSchema),
178
+ z.lazy(() => EventStatsUpdated$inboundSchema),
179
+ ]);
180
+
181
+ export function statsSubscribeServerSentEventsFromJSON(
182
+ jsonString: string,
183
+ ): SafeParseResult<StatsSubscribeServerSentEvents, SDKValidationError> {
184
+ return safeParse(
185
+ jsonString,
186
+ (x) => StatsSubscribeServerSentEvents$inboundSchema.parse(JSON.parse(x)),
187
+ `Failed to parse 'StatsSubscribeServerSentEvents' from JSON`,
188
+ );
189
+ }
190
+
191
+ /** @internal */
192
+ export const StatsSubscribeResponse$inboundSchema: z.ZodType<
193
+ StatsSubscribeResponse,
194
+ z.ZodTypeDef,
195
+ unknown
196
+ > = z.object({
197
+ HttpMeta: components.HTTPMetadata$inboundSchema,
198
+ "Server Sent Events": z.instanceof(ReadableStream<Uint8Array>)
199
+ .transform(stream => {
200
+ return new EventStream(stream, rawEvent => {
201
+ return {
202
+ done: false,
203
+ value: z.union([
204
+ z.lazy(() => EventStatsHeartbeat$inboundSchema),
205
+ z.lazy(() => EventStatsSnapshot$inboundSchema),
206
+ z.lazy(() => EventStatsUpdated$inboundSchema),
207
+ ]).parse(rawEvent),
208
+ };
209
+ });
210
+ }).optional(),
211
+ ErrorModel: components.ErrorModel$inboundSchema.optional(),
212
+ }).transform((v) => {
213
+ return remap$(v, {
214
+ "HttpMeta": "httpMeta",
215
+ "Server Sent Events": "serverSentEvents",
216
+ "ErrorModel": "errorModel",
217
+ });
218
+ });
219
+
220
+ export function statsSubscribeResponseFromJSON(
221
+ jsonString: string,
222
+ ): SafeParseResult<StatsSubscribeResponse, SDKValidationError> {
223
+ return safeParse(
224
+ jsonString,
225
+ (x) => StatsSubscribeResponse$inboundSchema.parse(JSON.parse(x)),
226
+ `Failed to parse 'StatsSubscribeResponse' from JSON`,
227
+ );
228
+ }
@@ -36,6 +36,7 @@ import { accountReconnectConnection } from "../funcs/accountReconnectConnection.
36
36
  import { accountRefreshInventory } from "../funcs/accountRefreshInventory.js";
37
37
  import { accountRefreshSession } from "../funcs/accountRefreshSession.js";
38
38
  import { accountSendEmailVerification } from "../funcs/accountSendEmailVerification.js";
39
+ import { accountSubscribe } from "../funcs/accountSubscribe.js";
39
40
  import { accountSubscribeEmail } from "../funcs/accountSubscribeEmail.js";
40
41
  import { accountUpdateConnection } from "../funcs/accountUpdateConnection.js";
41
42
  import { accountUpdateDeveloperApp } from "../funcs/accountUpdateDeveloperApp.js";
@@ -518,6 +519,20 @@ export class Account extends ClientSDK {
518
519
  ));
519
520
  }
520
521
 
522
+ /**
523
+ * Server-sent-events stream of per-account updates (queue status, view ticks).
524
+ */
525
+ async subscribe(
526
+ request: operations.AccountSubscribeRequest,
527
+ options?: RequestOptions,
528
+ ): Promise<operations.AccountSubscribeResponse> {
529
+ return unwrapAsync(accountSubscribe(
530
+ this,
531
+ request,
532
+ options,
533
+ ));
534
+ }
535
+
521
536
  /**
522
537
  * Subscribe to email notifications
523
538
  */
package/src/sdk/stats.ts CHANGED
@@ -3,10 +3,16 @@
3
3
  */
4
4
 
5
5
  import { statsGet } from "../funcs/statsGet.js";
6
+ import {
7
+ statsSubscribe,
8
+ SubscribeAcceptEnum,
9
+ } from "../funcs/statsSubscribe.js";
6
10
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
11
  import * as operations from "../models/operations/index.js";
8
12
  import { unwrapAsync } from "../types/fp.js";
9
13
 
14
+ export { SubscribeAcceptEnum } from "../funcs/statsSubscribe.js";
15
+
10
16
  export class Stats extends ClientSDK {
11
17
  /**
12
18
  * Get platform statistics
@@ -19,4 +25,16 @@ export class Stats extends ClientSDK {
19
25
  options,
20
26
  ));
21
27
  }
28
+
29
+ /**
30
+ * Server-sent-events stream of platform stats. Emits a snapshot, then deltas as the queues commit them.
31
+ */
32
+ async subscribe(
33
+ options?: RequestOptions & { acceptHeaderOverride?: SubscribeAcceptEnum },
34
+ ): Promise<operations.StatsSubscribeResponse> {
35
+ return unwrapAsync(statsSubscribe(
36
+ this,
37
+ options,
38
+ ));
39
+ }
22
40
  }