@steamsets/client-ts 0.34.4 → 0.34.5

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 (59) hide show
  1. package/README.md +5 -0
  2. package/funcs/siteSubscribe.d.ts +20 -0
  3. package/funcs/siteSubscribe.d.ts.map +1 -0
  4. package/funcs/siteSubscribe.js +128 -0
  5. package/funcs/siteSubscribe.js.map +1 -0
  6. package/jsr.json +1 -1
  7. package/lib/config.d.ts +2 -2
  8. package/lib/config.js +2 -2
  9. package/models/components/accountsubscribeheartbeat.d.ts +10 -0
  10. package/models/components/accountsubscribeheartbeat.d.ts.map +1 -0
  11. package/models/components/accountsubscribeheartbeat.js +50 -0
  12. package/models/components/accountsubscribeheartbeat.js.map +1 -0
  13. package/models/components/index.d.ts +3 -1
  14. package/models/components/index.d.ts.map +1 -1
  15. package/models/components/index.js +3 -1
  16. package/models/components/index.js.map +1 -1
  17. package/models/components/maintenancechanged.d.ts +11 -0
  18. package/models/components/maintenancechanged.d.ts.map +1 -0
  19. package/models/components/maintenancechanged.js +51 -0
  20. package/models/components/maintenancechanged.js.map +1 -0
  21. package/models/components/sitesubscribeheartbeat.d.ts +10 -0
  22. package/models/components/sitesubscribeheartbeat.d.ts.map +1 -0
  23. package/models/components/{heartbeat.js → sitesubscribeheartbeat.js} +6 -6
  24. package/models/components/sitesubscribeheartbeat.js.map +1 -0
  25. package/models/operations/accountsubscribe.d.ts +1 -1
  26. package/models/operations/accountsubscribe.d.ts.map +1 -1
  27. package/models/operations/accountsubscribe.js +1 -1
  28. package/models/operations/accountsubscribe.js.map +1 -1
  29. package/models/operations/index.d.ts +1 -0
  30. package/models/operations/index.d.ts.map +1 -1
  31. package/models/operations/index.js +1 -0
  32. package/models/operations/index.js.map +1 -1
  33. package/models/operations/sitesubscribe.d.ts +63 -0
  34. package/models/operations/sitesubscribe.d.ts.map +1 -0
  35. package/models/operations/sitesubscribe.js +119 -0
  36. package/models/operations/sitesubscribe.js.map +1 -0
  37. package/package.json +1 -1
  38. package/sdk/sdk.d.ts +3 -0
  39. package/sdk/sdk.d.ts.map +1 -1
  40. package/sdk/sdk.js +4 -0
  41. package/sdk/sdk.js.map +1 -1
  42. package/sdk/site.d.ts +13 -0
  43. package/sdk/site.d.ts.map +1 -0
  44. package/sdk/site.js +21 -0
  45. package/sdk/site.js.map +1 -0
  46. package/src/funcs/siteSubscribe.ts +168 -0
  47. package/src/lib/config.ts +2 -2
  48. package/src/models/components/accountsubscribeheartbeat.ts +31 -0
  49. package/src/models/components/index.ts +3 -1
  50. package/src/models/components/maintenancechanged.ts +35 -0
  51. package/src/models/components/{heartbeat.ts → sitesubscribeheartbeat.ts} +7 -7
  52. package/src/models/operations/accountsubscribe.ts +2 -2
  53. package/src/models/operations/index.ts +1 -0
  54. package/src/models/operations/sitesubscribe.ts +191 -0
  55. package/src/sdk/sdk.ts +6 -0
  56. package/src/sdk/site.ts +24 -0
  57. package/models/components/heartbeat.d.ts +0 -10
  58. package/models/components/heartbeat.d.ts.map +0 -1
  59. package/models/components/heartbeat.js.map +0 -1
@@ -0,0 +1,191 @@
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 EventMaintenanceChanged = {
14
+ data: components.MaintenanceChanged;
15
+ /**
16
+ * The event name.
17
+ */
18
+ event: "maintenance-changed";
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 SiteSubscribeServerSentEventsEventHeartbeat = {
30
+ data: components.SiteSubscribeHeartbeat;
31
+ /**
32
+ * The event name.
33
+ */
34
+ event: "heartbeat";
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
+ /**
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
+ */
48
+ export type SiteSubscribeServerSentEvents =
49
+ | SiteSubscribeServerSentEventsEventHeartbeat
50
+ | EventMaintenanceChanged;
51
+
52
+ export type SiteSubscribeResponse = {
53
+ httpMeta: components.HTTPMetadata;
54
+ /**
55
+ * OK
56
+ */
57
+ serverSentEvents?:
58
+ | EventStream<
59
+ SiteSubscribeServerSentEventsEventHeartbeat | EventMaintenanceChanged
60
+ >
61
+ | undefined;
62
+ /**
63
+ * Error
64
+ */
65
+ errorModel?: components.ErrorModel | undefined;
66
+ };
67
+
68
+ /** @internal */
69
+ export const EventMaintenanceChanged$inboundSchema: z.ZodType<
70
+ EventMaintenanceChanged,
71
+ z.ZodTypeDef,
72
+ unknown
73
+ > = z.object({
74
+ data: z.string().transform((v, ctx) => {
75
+ try {
76
+ return JSON.parse(v);
77
+ } catch (err) {
78
+ ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
79
+ return z.NEVER;
80
+ }
81
+ }).pipe(components.MaintenanceChanged$inboundSchema),
82
+ event: z.literal("maintenance-changed"),
83
+ id: z.string().optional(),
84
+ retry: z.number().int().optional(),
85
+ });
86
+
87
+ export function eventMaintenanceChangedFromJSON(
88
+ jsonString: string,
89
+ ): SafeParseResult<EventMaintenanceChanged, SDKValidationError> {
90
+ return safeParse(
91
+ jsonString,
92
+ (x) => EventMaintenanceChanged$inboundSchema.parse(JSON.parse(x)),
93
+ `Failed to parse 'EventMaintenanceChanged' from JSON`,
94
+ );
95
+ }
96
+
97
+ /** @internal */
98
+ export const SiteSubscribeServerSentEventsEventHeartbeat$inboundSchema:
99
+ z.ZodType<
100
+ SiteSubscribeServerSentEventsEventHeartbeat,
101
+ z.ZodTypeDef,
102
+ unknown
103
+ > = z.object({
104
+ data: z.string().transform((v, ctx) => {
105
+ try {
106
+ return JSON.parse(v);
107
+ } catch (err) {
108
+ ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
109
+ return z.NEVER;
110
+ }
111
+ }).pipe(components.SiteSubscribeHeartbeat$inboundSchema),
112
+ event: z.literal("heartbeat"),
113
+ id: z.string().optional(),
114
+ retry: z.number().int().optional(),
115
+ });
116
+
117
+ export function siteSubscribeServerSentEventsEventHeartbeatFromJSON(
118
+ jsonString: string,
119
+ ): SafeParseResult<
120
+ SiteSubscribeServerSentEventsEventHeartbeat,
121
+ SDKValidationError
122
+ > {
123
+ return safeParse(
124
+ jsonString,
125
+ (x) =>
126
+ SiteSubscribeServerSentEventsEventHeartbeat$inboundSchema.parse(
127
+ JSON.parse(x),
128
+ ),
129
+ `Failed to parse 'SiteSubscribeServerSentEventsEventHeartbeat' from JSON`,
130
+ );
131
+ }
132
+
133
+ /** @internal */
134
+ export const SiteSubscribeServerSentEvents$inboundSchema: z.ZodType<
135
+ SiteSubscribeServerSentEvents,
136
+ z.ZodTypeDef,
137
+ unknown
138
+ > = z.union([
139
+ z.lazy(() => SiteSubscribeServerSentEventsEventHeartbeat$inboundSchema),
140
+ z.lazy(() => EventMaintenanceChanged$inboundSchema),
141
+ ]);
142
+
143
+ export function siteSubscribeServerSentEventsFromJSON(
144
+ jsonString: string,
145
+ ): SafeParseResult<SiteSubscribeServerSentEvents, SDKValidationError> {
146
+ return safeParse(
147
+ jsonString,
148
+ (x) => SiteSubscribeServerSentEvents$inboundSchema.parse(JSON.parse(x)),
149
+ `Failed to parse 'SiteSubscribeServerSentEvents' from JSON`,
150
+ );
151
+ }
152
+
153
+ /** @internal */
154
+ export const SiteSubscribeResponse$inboundSchema: z.ZodType<
155
+ SiteSubscribeResponse,
156
+ z.ZodTypeDef,
157
+ unknown
158
+ > = z.object({
159
+ HttpMeta: components.HTTPMetadata$inboundSchema,
160
+ "Server Sent Events": z.instanceof(ReadableStream<Uint8Array>)
161
+ .transform(stream => {
162
+ return new EventStream(stream, rawEvent => {
163
+ return {
164
+ done: false,
165
+ value: z.union([
166
+ z.lazy(() =>
167
+ SiteSubscribeServerSentEventsEventHeartbeat$inboundSchema
168
+ ),
169
+ z.lazy(() => EventMaintenanceChanged$inboundSchema),
170
+ ]).parse(rawEvent),
171
+ };
172
+ });
173
+ }).optional(),
174
+ ErrorModel: components.ErrorModel$inboundSchema.optional(),
175
+ }).transform((v) => {
176
+ return remap$(v, {
177
+ "HttpMeta": "httpMeta",
178
+ "Server Sent Events": "serverSentEvents",
179
+ "ErrorModel": "errorModel",
180
+ });
181
+ });
182
+
183
+ export function siteSubscribeResponseFromJSON(
184
+ jsonString: string,
185
+ ): SafeParseResult<SiteSubscribeResponse, SDKValidationError> {
186
+ return safeParse(
187
+ jsonString,
188
+ (x) => SiteSubscribeResponse$inboundSchema.parse(JSON.parse(x)),
189
+ `Failed to parse 'SiteSubscribeResponse' from JSON`,
190
+ );
191
+ }
package/src/sdk/sdk.ts CHANGED
@@ -18,6 +18,7 @@ import { Leaderboards } from "./leaderboards.js";
18
18
  import { Location } from "./location.js";
19
19
  import { Maintenance } from "./maintenance.js";
20
20
  import { Search } from "./search.js";
21
+ import { Site } from "./site.js";
21
22
  import { Staff } from "./staff.js";
22
23
  import { Stats } from "./stats.js";
23
24
 
@@ -97,6 +98,11 @@ export class SteamSets extends ClientSDK {
97
98
  return (this._search ??= new Search(this._options));
98
99
  }
99
100
 
101
+ private _site?: Site;
102
+ get site(): Site {
103
+ return (this._site ??= new Site(this._options));
104
+ }
105
+
100
106
  private _staff?: Staff;
101
107
  get staff(): Staff {
102
108
  return (this._staff ??= new Staff(this._options));
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { siteSubscribe, SubscribeAcceptEnum } from "../funcs/siteSubscribe.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 { SubscribeAcceptEnum } from "../funcs/siteSubscribe.js";
11
+
12
+ export class Site extends ClientSDK {
13
+ /**
14
+ * Server-sent-events stream of site-wide broadcasts (maintenance, announcements, etc).
15
+ */
16
+ async subscribe(
17
+ options?: RequestOptions & { acceptHeaderOverride?: SubscribeAcceptEnum },
18
+ ): Promise<operations.SiteSubscribeResponse> {
19
+ return unwrapAsync(siteSubscribe(
20
+ this,
21
+ options,
22
+ ));
23
+ }
24
+ }
@@ -1,10 +0,0 @@
1
- import * as z from "zod/v3";
2
- import { Result as SafeParseResult } from "../../types/fp.js";
3
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
4
- export type Heartbeat = {
5
- heartbeat: number;
6
- };
7
- /** @internal */
8
- export declare const Heartbeat$inboundSchema: z.ZodType<Heartbeat, z.ZodTypeDef, unknown>;
9
- export declare function heartbeatFromJSON(jsonString: string): SafeParseResult<Heartbeat, SDKValidationError>;
10
- //# sourceMappingURL=heartbeat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../src/models/components/heartbeat.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAC7C,SAAS,EACT,CAAC,CAAC,UAAU,EACZ,OAAO,CAGP,CAAC;AAEH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAMhD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../src/models/components/heartbeat.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBH,8CAQC;AA1BD,0CAA4B;AAC5B,qDAAiD;AAQjD,gBAAgB;AACH,QAAA,uBAAuB,GAIhC,CAAC,CAAC,MAAM,CAAC;IACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CAC5B,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAC/B,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACnD,uCAAuC,CACxC,CAAC;AACJ,CAAC"}