@steamsets/client-ts 0.34.4 → 0.34.6

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 (199) hide show
  1. package/README.md +15 -0
  2. package/funcs/analyticsGetBivariate.d.ts +16 -0
  3. package/funcs/analyticsGetBivariate.d.ts.map +1 -0
  4. package/funcs/analyticsGetBivariate.js +134 -0
  5. package/funcs/analyticsGetBivariate.js.map +1 -0
  6. package/funcs/analyticsGetDistribution.d.ts +16 -0
  7. package/funcs/analyticsGetDistribution.d.ts.map +1 -0
  8. package/funcs/analyticsGetDistribution.js +134 -0
  9. package/funcs/analyticsGetDistribution.js.map +1 -0
  10. package/funcs/analyticsGetMyPercentiles.d.ts +16 -0
  11. package/funcs/analyticsGetMyPercentiles.d.ts.map +1 -0
  12. package/funcs/analyticsGetMyPercentiles.js +134 -0
  13. package/funcs/analyticsGetMyPercentiles.js.map +1 -0
  14. package/funcs/analyticsGetTrend.d.ts +16 -0
  15. package/funcs/analyticsGetTrend.d.ts.map +1 -0
  16. package/funcs/analyticsGetTrend.js +134 -0
  17. package/funcs/analyticsGetTrend.js.map +1 -0
  18. package/funcs/analyticsListMetrics.d.ts +15 -0
  19. package/funcs/analyticsListMetrics.d.ts.map +1 -0
  20. package/funcs/analyticsListMetrics.js +121 -0
  21. package/funcs/analyticsListMetrics.js.map +1 -0
  22. package/funcs/siteSubscribe.d.ts +20 -0
  23. package/funcs/siteSubscribe.d.ts.map +1 -0
  24. package/funcs/siteSubscribe.js +128 -0
  25. package/funcs/siteSubscribe.js.map +1 -0
  26. package/jsr.json +1 -1
  27. package/lib/config.d.ts +2 -2
  28. package/lib/config.js +2 -2
  29. package/models/components/accountsubscribeheartbeat.d.ts +10 -0
  30. package/models/components/accountsubscribeheartbeat.d.ts.map +1 -0
  31. package/models/components/accountsubscribeheartbeat.js +50 -0
  32. package/models/components/accountsubscribeheartbeat.js.map +1 -0
  33. package/models/components/analyticsbin.d.ts +12 -0
  34. package/models/components/analyticsbin.d.ts.map +1 -0
  35. package/models/components/analyticsbin.js +58 -0
  36. package/models/components/analyticsbin.js.map +1 -0
  37. package/models/components/analyticsbivariate.d.ts +15 -0
  38. package/models/components/analyticsbivariate.d.ts.map +1 -0
  39. package/models/components/analyticsbivariate.js +57 -0
  40. package/models/components/analyticsbivariate.js.map +1 -0
  41. package/models/components/analyticsbivariatebucket.d.ts +12 -0
  42. package/models/components/analyticsbivariatebucket.d.ts.map +1 -0
  43. package/models/components/analyticsbivariatebucket.js +58 -0
  44. package/models/components/analyticsbivariatebucket.js.map +1 -0
  45. package/models/components/analyticsdistribution.d.ts +17 -0
  46. package/models/components/analyticsdistribution.d.ts.map +1 -0
  47. package/models/components/analyticsdistribution.js +59 -0
  48. package/models/components/analyticsdistribution.js.map +1 -0
  49. package/models/components/analyticsdomainentry.d.ts +14 -0
  50. package/models/components/analyticsdomainentry.d.ts.map +1 -0
  51. package/models/components/analyticsdomainentry.js +54 -0
  52. package/models/components/analyticsdomainentry.js.map +1 -0
  53. package/models/components/analyticsgetbivariaterequestbody.d.ts +46 -0
  54. package/models/components/analyticsgetbivariaterequestbody.d.ts.map +1 -0
  55. package/models/components/analyticsgetbivariaterequestbody.js +69 -0
  56. package/models/components/analyticsgetbivariaterequestbody.js.map +1 -0
  57. package/models/components/analyticsgetdistributionrequestbody.d.ts +30 -0
  58. package/models/components/analyticsgetdistributionrequestbody.d.ts.map +1 -0
  59. package/models/components/analyticsgetdistributionrequestbody.js +57 -0
  60. package/models/components/analyticsgetdistributionrequestbody.js.map +1 -0
  61. package/models/components/analyticsgetmypercentilesrequestbody.d.ts +16 -0
  62. package/models/components/analyticsgetmypercentilesrequestbody.d.ts.map +1 -0
  63. package/models/components/analyticsgetmypercentilesrequestbody.js +56 -0
  64. package/models/components/analyticsgetmypercentilesrequestbody.js.map +1 -0
  65. package/models/components/analyticsgettrendrequestbody.d.ts +47 -0
  66. package/models/components/analyticsgettrendrequestbody.d.ts.map +1 -0
  67. package/models/components/analyticsgettrendrequestbody.js +68 -0
  68. package/models/components/analyticsgettrendrequestbody.js.map +1 -0
  69. package/models/components/analyticslistmetricsresponsebody.d.ts +15 -0
  70. package/models/components/analyticslistmetricsresponsebody.d.ts.map +1 -0
  71. package/models/components/analyticslistmetricsresponsebody.js +57 -0
  72. package/models/components/analyticslistmetricsresponsebody.js.map +1 -0
  73. package/models/components/analyticsmetricentry.d.ts +12 -0
  74. package/models/components/analyticsmetricentry.d.ts.map +1 -0
  75. package/models/components/analyticsmetricentry.js +52 -0
  76. package/models/components/analyticsmetricentry.js.map +1 -0
  77. package/models/components/analyticsmypercentiles.d.ts +16 -0
  78. package/models/components/analyticsmypercentiles.d.ts.map +1 -0
  79. package/models/components/analyticsmypercentiles.js +58 -0
  80. package/models/components/analyticsmypercentiles.js.map +1 -0
  81. package/models/components/analyticspercentile.d.ts +12 -0
  82. package/models/components/analyticspercentile.d.ts.map +1 -0
  83. package/models/components/analyticspercentile.js +52 -0
  84. package/models/components/analyticspercentile.js.map +1 -0
  85. package/models/components/analyticsscopeentry.d.ts +12 -0
  86. package/models/components/analyticsscopeentry.d.ts.map +1 -0
  87. package/models/components/analyticsscopeentry.js +57 -0
  88. package/models/components/analyticsscopeentry.js.map +1 -0
  89. package/models/components/analyticssummary.d.ts +16 -0
  90. package/models/components/analyticssummary.d.ts.map +1 -0
  91. package/models/components/analyticssummary.js +56 -0
  92. package/models/components/analyticssummary.js.map +1 -0
  93. package/models/components/analyticstrend.d.ts +15 -0
  94. package/models/components/analyticstrend.d.ts.map +1 -0
  95. package/models/components/analyticstrend.js +57 -0
  96. package/models/components/analyticstrend.js.map +1 -0
  97. package/models/components/analyticstrendpoint.d.ts +14 -0
  98. package/models/components/analyticstrendpoint.d.ts.map +1 -0
  99. package/models/components/analyticstrendpoint.js +54 -0
  100. package/models/components/analyticstrendpoint.js.map +1 -0
  101. package/models/components/index.d.ts +20 -1
  102. package/models/components/index.d.ts.map +1 -1
  103. package/models/components/index.js +20 -1
  104. package/models/components/index.js.map +1 -1
  105. package/models/components/maintenancechanged.d.ts +11 -0
  106. package/models/components/maintenancechanged.d.ts.map +1 -0
  107. package/models/components/maintenancechanged.js +51 -0
  108. package/models/components/maintenancechanged.js.map +1 -0
  109. package/models/components/sitesubscribeheartbeat.d.ts +10 -0
  110. package/models/components/sitesubscribeheartbeat.d.ts.map +1 -0
  111. package/models/components/{heartbeat.js → sitesubscribeheartbeat.js} +6 -6
  112. package/models/components/sitesubscribeheartbeat.js.map +1 -0
  113. package/models/operations/accountsubscribe.d.ts +1 -1
  114. package/models/operations/accountsubscribe.d.ts.map +1 -1
  115. package/models/operations/accountsubscribe.js +1 -1
  116. package/models/operations/accountsubscribe.js.map +1 -1
  117. package/models/operations/analyticsgetbivariate.d.ts +15 -0
  118. package/models/operations/analyticsgetbivariate.d.ts.map +1 -0
  119. package/models/operations/analyticsgetbivariate.js +58 -0
  120. package/models/operations/analyticsgetbivariate.js.map +1 -0
  121. package/models/operations/analyticsgetdistribution.d.ts +15 -0
  122. package/models/operations/analyticsgetdistribution.d.ts.map +1 -0
  123. package/models/operations/analyticsgetdistribution.js +59 -0
  124. package/models/operations/analyticsgetdistribution.js.map +1 -0
  125. package/models/operations/analyticsgetmypercentiles.d.ts +15 -0
  126. package/models/operations/analyticsgetmypercentiles.d.ts.map +1 -0
  127. package/models/operations/analyticsgetmypercentiles.js +59 -0
  128. package/models/operations/analyticsgetmypercentiles.js.map +1 -0
  129. package/models/operations/analyticsgettrend.d.ts +15 -0
  130. package/models/operations/analyticsgettrend.d.ts.map +1 -0
  131. package/models/operations/analyticsgettrend.js +58 -0
  132. package/models/operations/analyticsgettrend.js.map +1 -0
  133. package/models/operations/analyticslistmetrics.d.ts +15 -0
  134. package/models/operations/analyticslistmetrics.d.ts.map +1 -0
  135. package/models/operations/analyticslistmetrics.js +59 -0
  136. package/models/operations/analyticslistmetrics.js.map +1 -0
  137. package/models/operations/index.d.ts +6 -0
  138. package/models/operations/index.d.ts.map +1 -1
  139. package/models/operations/index.js +6 -0
  140. package/models/operations/index.js.map +1 -1
  141. package/models/operations/sitesubscribe.d.ts +63 -0
  142. package/models/operations/sitesubscribe.d.ts.map +1 -0
  143. package/models/operations/sitesubscribe.js +119 -0
  144. package/models/operations/sitesubscribe.js.map +1 -0
  145. package/package.json +1 -1
  146. package/sdk/analytics.d.ts +21 -0
  147. package/sdk/analytics.d.ts.map +1 -1
  148. package/sdk/analytics.js +35 -0
  149. package/sdk/analytics.js.map +1 -1
  150. package/sdk/sdk.d.ts +3 -0
  151. package/sdk/sdk.d.ts.map +1 -1
  152. package/sdk/sdk.js +4 -0
  153. package/sdk/sdk.js.map +1 -1
  154. package/sdk/site.d.ts +13 -0
  155. package/sdk/site.d.ts.map +1 -0
  156. package/sdk/site.js +21 -0
  157. package/sdk/site.js.map +1 -0
  158. package/src/funcs/analyticsGetBivariate.ts +188 -0
  159. package/src/funcs/analyticsGetDistribution.ts +190 -0
  160. package/src/funcs/analyticsGetMyPercentiles.ts +190 -0
  161. package/src/funcs/analyticsGetTrend.ts +188 -0
  162. package/src/funcs/analyticsListMetrics.ts +165 -0
  163. package/src/funcs/siteSubscribe.ts +168 -0
  164. package/src/lib/config.ts +2 -2
  165. package/src/models/components/accountsubscribeheartbeat.ts +31 -0
  166. package/src/models/components/analyticsbin.ts +41 -0
  167. package/src/models/components/analyticsbivariate.ts +45 -0
  168. package/src/models/components/analyticsbivariatebucket.ts +41 -0
  169. package/src/models/components/analyticsdistribution.ts +48 -0
  170. package/src/models/components/analyticsdomainentry.ts +43 -0
  171. package/src/models/components/analyticsgetbivariaterequestbody.ts +81 -0
  172. package/src/models/components/analyticsgetdistributionrequestbody.ts +59 -0
  173. package/src/models/components/analyticsgetmypercentilesrequestbody.ts +44 -0
  174. package/src/models/components/analyticsgettrendrequestbody.ts +83 -0
  175. package/src/models/components/analyticslistmetricsresponsebody.ts +45 -0
  176. package/src/models/components/analyticsmetricentry.ts +35 -0
  177. package/src/models/components/analyticsmypercentiles.ts +47 -0
  178. package/src/models/components/analyticspercentile.ts +35 -0
  179. package/src/models/components/analyticsscopeentry.ts +40 -0
  180. package/src/models/components/analyticssummary.ts +43 -0
  181. package/src/models/components/analyticstrend.ts +45 -0
  182. package/src/models/components/analyticstrendpoint.ts +39 -0
  183. package/src/models/components/index.ts +20 -1
  184. package/src/models/components/maintenancechanged.ts +35 -0
  185. package/src/models/components/{heartbeat.ts → sitesubscribeheartbeat.ts} +7 -7
  186. package/src/models/operations/accountsubscribe.ts +2 -2
  187. package/src/models/operations/analyticsgetbivariate.ts +43 -0
  188. package/src/models/operations/analyticsgetdistribution.ts +44 -0
  189. package/src/models/operations/analyticsgetmypercentiles.ts +44 -0
  190. package/src/models/operations/analyticsgettrend.ts +43 -0
  191. package/src/models/operations/analyticslistmetrics.ts +46 -0
  192. package/src/models/operations/index.ts +6 -0
  193. package/src/models/operations/sitesubscribe.ts +191 -0
  194. package/src/sdk/analytics.ts +74 -0
  195. package/src/sdk/sdk.ts +6 -0
  196. package/src/sdk/site.ts +24 -0
  197. package/models/components/heartbeat.d.ts +0 -10
  198. package/models/components/heartbeat.d.ts.map +0 -1
  199. package/models/components/heartbeat.js.map +0 -1
@@ -0,0 +1,190 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SteamSetsCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { SteamSetsError } from "../models/errors/steamsetserror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Per-metric percentile rank for the logged-in user in the chosen scope
32
+ */
33
+ export function analyticsGetMyPercentiles(
34
+ client: SteamSetsCore,
35
+ request: components.AnalyticsGetMyPercentilesRequestBody,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.AnalyticsGetMyPercentilesResponse,
40
+ | errors.ErrorModel
41
+ | SteamSetsError
42
+ | ResponseValidationError
43
+ | ConnectionError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | InvalidRequestError
47
+ | UnexpectedClientError
48
+ | SDKValidationError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client: SteamSetsCore,
60
+ request: components.AnalyticsGetMyPercentilesRequestBody,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ operations.AnalyticsGetMyPercentilesResponse,
66
+ | errors.ErrorModel
67
+ | SteamSetsError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ components.AnalyticsGetMyPercentilesRequestBody$outboundSchema.parse(
83
+ value,
84
+ ),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = encodeJSON("body", payload, { explode: true });
92
+
93
+ const path = pathToFunc("/v1/analytics.getMyPercentiles")();
94
+
95
+ const headers = new Headers(compactMap({
96
+ "Content-Type": "application/json",
97
+ Accept: "application/json",
98
+ }));
99
+
100
+ const secConfig = await extractSecurity(client._options.token);
101
+ const securityInput = secConfig == null ? {} : { token: secConfig };
102
+ const requestSecurity = resolveGlobalSecurity(securityInput);
103
+
104
+ const context = {
105
+ options: client._options,
106
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
107
+ operationID: "analytics.getMyPercentiles",
108
+ oAuth2Scopes: null,
109
+
110
+ resolvedSecurity: requestSecurity,
111
+
112
+ securitySource: client._options.token,
113
+ retryConfig: options?.retries
114
+ || client._options.retryConfig
115
+ || {
116
+ strategy: "backoff",
117
+ backoff: {
118
+ initialInterval: 500,
119
+ maxInterval: 5000,
120
+ exponent: 1.5,
121
+ maxElapsedTime: 60000,
122
+ },
123
+ retryConnectionErrors: true,
124
+ }
125
+ || { strategy: "none" },
126
+ retryCodes: options?.retryCodes || ["501", "502", "503", "504"],
127
+ };
128
+
129
+ const requestRes = client._createRequest(context, {
130
+ security: requestSecurity,
131
+ method: "POST",
132
+ baseURL: options?.serverURL,
133
+ path: path,
134
+ headers: headers,
135
+ body: body,
136
+ uaHeader: "x-speakeasy-user-agent",
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ isErrorStatusCode: (statusCode: number) =>
148
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
149
+ retryConfig: context.retryConfig,
150
+ retryCodes: context.retryCodes,
151
+ });
152
+ if (!doResult.ok) {
153
+ return [doResult, { status: "request-error", request: req }];
154
+ }
155
+ const response = doResult.value;
156
+
157
+ const responseFields = {
158
+ HttpMeta: { Response: response, Request: req },
159
+ };
160
+
161
+ const [result] = await M.match<
162
+ operations.AnalyticsGetMyPercentilesResponse,
163
+ | errors.ErrorModel
164
+ | SteamSetsError
165
+ | ResponseValidationError
166
+ | ConnectionError
167
+ | RequestAbortedError
168
+ | RequestTimeoutError
169
+ | InvalidRequestError
170
+ | UnexpectedClientError
171
+ | SDKValidationError
172
+ >(
173
+ M.json(200, operations.AnalyticsGetMyPercentilesResponse$inboundSchema, {
174
+ key: "AnalyticsMyPercentiles",
175
+ }),
176
+ M.jsonErr([400, 401, 422], errors.ErrorModel$inboundSchema, {
177
+ ctype: "application/problem+json",
178
+ }),
179
+ M.jsonErr(500, errors.ErrorModel$inboundSchema, {
180
+ ctype: "application/problem+json",
181
+ }),
182
+ M.fail("4XX"),
183
+ M.fail("5XX"),
184
+ )(response, req, { extraFields: responseFields });
185
+ if (!result.ok) {
186
+ return [result, { status: "complete", request: req, response }];
187
+ }
188
+
189
+ return [result, { status: "complete", request: req, response }];
190
+ }
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SteamSetsCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { SteamSetsError } from "../models/errors/steamsetserror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Daily quantiles over a window for a metric in a scope
32
+ */
33
+ export function analyticsGetTrend(
34
+ client: SteamSetsCore,
35
+ request: components.AnalyticsGetTrendRequestBody,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.AnalyticsGetTrendResponse,
40
+ | errors.ErrorModel
41
+ | SteamSetsError
42
+ | ResponseValidationError
43
+ | ConnectionError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | InvalidRequestError
47
+ | UnexpectedClientError
48
+ | SDKValidationError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client: SteamSetsCore,
60
+ request: components.AnalyticsGetTrendRequestBody,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ operations.AnalyticsGetTrendResponse,
66
+ | errors.ErrorModel
67
+ | SteamSetsError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ components.AnalyticsGetTrendRequestBody$outboundSchema.parse(value),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = encodeJSON("body", payload, { explode: true });
90
+
91
+ const path = pathToFunc("/v1/analytics.getTrend")();
92
+
93
+ const headers = new Headers(compactMap({
94
+ "Content-Type": "application/json",
95
+ Accept: "application/json",
96
+ }));
97
+
98
+ const secConfig = await extractSecurity(client._options.token);
99
+ const securityInput = secConfig == null ? {} : { token: secConfig };
100
+ const requestSecurity = resolveGlobalSecurity(securityInput);
101
+
102
+ const context = {
103
+ options: client._options,
104
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
105
+ operationID: "analytics.getTrend",
106
+ oAuth2Scopes: null,
107
+
108
+ resolvedSecurity: requestSecurity,
109
+
110
+ securitySource: client._options.token,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || {
114
+ strategy: "backoff",
115
+ backoff: {
116
+ initialInterval: 500,
117
+ maxInterval: 5000,
118
+ exponent: 1.5,
119
+ maxElapsedTime: 60000,
120
+ },
121
+ retryConnectionErrors: true,
122
+ }
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["501", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "POST",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ body: body,
134
+ uaHeader: "x-speakeasy-user-agent",
135
+ userAgent: client._options.userAgent,
136
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
137
+ }, options);
138
+ if (!requestRes.ok) {
139
+ return [requestRes, { status: "invalid" }];
140
+ }
141
+ const req = requestRes.value;
142
+
143
+ const doResult = await client._do(req, {
144
+ context,
145
+ isErrorStatusCode: (statusCode: number) =>
146
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
147
+ retryConfig: context.retryConfig,
148
+ retryCodes: context.retryCodes,
149
+ });
150
+ if (!doResult.ok) {
151
+ return [doResult, { status: "request-error", request: req }];
152
+ }
153
+ const response = doResult.value;
154
+
155
+ const responseFields = {
156
+ HttpMeta: { Response: response, Request: req },
157
+ };
158
+
159
+ const [result] = await M.match<
160
+ operations.AnalyticsGetTrendResponse,
161
+ | errors.ErrorModel
162
+ | SteamSetsError
163
+ | ResponseValidationError
164
+ | ConnectionError
165
+ | RequestAbortedError
166
+ | RequestTimeoutError
167
+ | InvalidRequestError
168
+ | UnexpectedClientError
169
+ | SDKValidationError
170
+ >(
171
+ M.json(200, operations.AnalyticsGetTrendResponse$inboundSchema, {
172
+ key: "AnalyticsTrend",
173
+ }),
174
+ M.jsonErr([400, 422], errors.ErrorModel$inboundSchema, {
175
+ ctype: "application/problem+json",
176
+ }),
177
+ M.jsonErr(500, errors.ErrorModel$inboundSchema, {
178
+ ctype: "application/problem+json",
179
+ }),
180
+ M.fail("4XX"),
181
+ M.fail("5XX"),
182
+ )(response, req, { extraFields: responseFields });
183
+ if (!result.ok) {
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
186
+
187
+ return [result, { status: "complete", request: req, response }];
188
+ }
@@ -0,0 +1,165 @@
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 * as errors from "../models/errors/index.js";
20
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import { SteamSetsError } from "../models/errors/steamsetserror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * List every analytics domain, metric, and scope the data-library can serve
29
+ */
30
+ export function analyticsListMetrics(
31
+ client: SteamSetsCore,
32
+ options?: RequestOptions,
33
+ ): APIPromise<
34
+ Result<
35
+ operations.AnalyticsListMetricsResponse,
36
+ | errors.ErrorModel
37
+ | SteamSetsError
38
+ | ResponseValidationError
39
+ | ConnectionError
40
+ | RequestAbortedError
41
+ | RequestTimeoutError
42
+ | InvalidRequestError
43
+ | UnexpectedClientError
44
+ | SDKValidationError
45
+ >
46
+ > {
47
+ return new APIPromise($do(
48
+ client,
49
+ options,
50
+ ));
51
+ }
52
+
53
+ async function $do(
54
+ client: SteamSetsCore,
55
+ options?: RequestOptions,
56
+ ): Promise<
57
+ [
58
+ Result<
59
+ operations.AnalyticsListMetricsResponse,
60
+ | errors.ErrorModel
61
+ | SteamSetsError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/v1/analytics.listMetrics")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.token);
80
+ const securityInput = secConfig == null ? {} : { token: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "analytics.listMetrics",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.token,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || {
95
+ strategy: "backoff",
96
+ backoff: {
97
+ initialInterval: 500,
98
+ maxInterval: 5000,
99
+ exponent: 1.5,
100
+ maxElapsedTime: 60000,
101
+ },
102
+ retryConnectionErrors: true,
103
+ }
104
+ || { strategy: "none" },
105
+ retryCodes: options?.retryCodes || ["501", "502", "503", "504"],
106
+ };
107
+
108
+ const requestRes = client._createRequest(context, {
109
+ security: requestSecurity,
110
+ method: "POST",
111
+ baseURL: options?.serverURL,
112
+ path: path,
113
+ headers: headers,
114
+ uaHeader: "x-speakeasy-user-agent",
115
+ userAgent: client._options.userAgent,
116
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
117
+ }, options);
118
+ if (!requestRes.ok) {
119
+ return [requestRes, { status: "invalid" }];
120
+ }
121
+ const req = requestRes.value;
122
+
123
+ const doResult = await client._do(req, {
124
+ context,
125
+ isErrorStatusCode: (statusCode: number) =>
126
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
127
+ retryConfig: context.retryConfig,
128
+ retryCodes: context.retryCodes,
129
+ });
130
+ if (!doResult.ok) {
131
+ return [doResult, { status: "request-error", request: req }];
132
+ }
133
+ const response = doResult.value;
134
+
135
+ const responseFields = {
136
+ HttpMeta: { Response: response, Request: req },
137
+ };
138
+
139
+ const [result] = await M.match<
140
+ operations.AnalyticsListMetricsResponse,
141
+ | errors.ErrorModel
142
+ | SteamSetsError
143
+ | ResponseValidationError
144
+ | ConnectionError
145
+ | RequestAbortedError
146
+ | RequestTimeoutError
147
+ | InvalidRequestError
148
+ | UnexpectedClientError
149
+ | SDKValidationError
150
+ >(
151
+ M.json(200, operations.AnalyticsListMetricsResponse$inboundSchema, {
152
+ key: "AnalyticsListMetricsResponseBody",
153
+ }),
154
+ M.jsonErr(500, errors.ErrorModel$inboundSchema, {
155
+ ctype: "application/problem+json",
156
+ }),
157
+ M.fail("4XX"),
158
+ M.fail("5XX"),
159
+ )(response, req, { extraFields: responseFields });
160
+ if (!result.ok) {
161
+ return [result, { status: "complete", request: req, response }];
162
+ }
163
+
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
@@ -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 site-wide broadcasts (maintenance, announcements, etc).
33
+ */
34
+ export function siteSubscribe(
35
+ client: SteamSetsCore,
36
+ options?: RequestOptions & { acceptHeaderOverride?: SubscribeAcceptEnum },
37
+ ): APIPromise<
38
+ Result<
39
+ operations.SiteSubscribeResponse,
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.SiteSubscribeResponse,
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/site.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: "site.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.SiteSubscribeResponse,
144
+ | SteamSetsError
145
+ | ResponseValidationError
146
+ | ConnectionError
147
+ | RequestAbortedError
148
+ | RequestTimeoutError
149
+ | InvalidRequestError
150
+ | UnexpectedClientError
151
+ | SDKValidationError
152
+ >(
153
+ M.sse(200, operations.SiteSubscribeResponse$inboundSchema, {
154
+ key: "Server Sent Events",
155
+ }),
156
+ M.fail("4XX"),
157
+ M.fail("5XX"),
158
+ M.json("default", operations.SiteSubscribeResponse$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
+ }