@bedrock-rbx/ocale 0.3.4 → 0.5.0

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 (95) hide show
  1. package/README.md +10 -5
  2. package/dist/assets.d.mts +64 -0
  3. package/dist/assets.d.mts.map +1 -0
  4. package/dist/assets.mjs +301 -0
  5. package/dist/assets.mjs.map +1 -0
  6. package/dist/badge-insufficient-funds-BLFvQZt1.mjs +91 -0
  7. package/dist/badge-insufficient-funds-BLFvQZt1.mjs.map +1 -0
  8. package/dist/badges.d.mts +359 -196
  9. package/dist/badges.d.mts.map +1 -1
  10. package/dist/badges.mjs +493 -59
  11. package/dist/badges.mjs.map +1 -1
  12. package/dist/capacity-admission-Ce2V9QNb.d.mts +347 -0
  13. package/dist/capacity-admission-Ce2V9QNb.d.mts.map +1 -0
  14. package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-B4Fztv_7.d.mts} +23 -25
  15. package/dist/data.generated-B4Fztv_7.d.mts.map +1 -0
  16. package/dist/developer-products.d.mts +207 -194
  17. package/dist/developer-products.d.mts.map +1 -1
  18. package/dist/developer-products.mjs +125 -39
  19. package/dist/developer-products.mjs.map +1 -1
  20. package/dist/game-passes.d.mts +206 -211
  21. package/dist/game-passes.d.mts.map +1 -1
  22. package/dist/game-passes.mjs +35 -36
  23. package/dist/game-passes.mjs.map +1 -1
  24. package/dist/index.d.mts +947 -366
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +324 -12
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/is-date-time-string-C91G44SI.mjs +19 -0
  29. package/dist/is-date-time-string-C91G44SI.mjs.map +1 -0
  30. package/dist/locales.d.mts +28 -2
  31. package/dist/locales.d.mts.map +1 -0
  32. package/dist/locales.mjs +24 -3
  33. package/dist/locales.mjs.map +1 -1
  34. package/dist/luau-execution.d.mts +154 -157
  35. package/dist/luau-execution.d.mts.map +1 -1
  36. package/dist/luau-execution.mjs +15 -16
  37. package/dist/luau-execution.mjs.map +1 -1
  38. package/dist/{network-error-DR9FX5hb.mjs → network-error-P4An7nUB.mjs} +48 -14
  39. package/dist/network-error-P4An7nUB.mjs.map +1 -0
  40. package/dist/places.d.mts +258 -186
  41. package/dist/places.d.mts.map +1 -1
  42. package/dist/places.mjs +187 -35
  43. package/dist/places.mjs.map +1 -1
  44. package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-BCxgN97O.mjs} +4 -6
  45. package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-BCxgN97O.mjs.map} +1 -1
  46. package/dist/{polling-helpers-CoVhsC33.mjs → polling-helpers-BtEYR5dN.mjs} +260 -105
  47. package/dist/polling-helpers-BtEYR5dN.mjs.map +1 -0
  48. package/dist/{price-information-B0tkOoAX.mjs → price-information--d6GZAcp.mjs} +3 -4
  49. package/dist/{price-information-B0tkOoAX.mjs.map → price-information--d6GZAcp.mjs.map} +1 -1
  50. package/dist/resource-client-CF8SPsV8.d.mts +162 -0
  51. package/dist/resource-client-CF8SPsV8.d.mts.map +1 -0
  52. package/dist/{resource-client-rqTMkBeR.mjs → resource-client-Cm_bPcCs.mjs} +589 -197
  53. package/dist/resource-client-Cm_bPcCs.mjs.map +1 -0
  54. package/dist/retry-DYxm_eBU.d.mts +225 -0
  55. package/dist/retry-DYxm_eBU.d.mts.map +1 -0
  56. package/dist/{retry-BlX4tUnT.mjs → retry-Dv5TsY9O.mjs} +312 -54
  57. package/dist/retry-Dv5TsY9O.mjs.map +1 -0
  58. package/dist/{signatures-JF-7Psce.mjs → signatures-CtJ7jfVN.mjs} +2 -3
  59. package/dist/{signatures-JF-7Psce.mjs.map → signatures-CtJ7jfVN.mjs.map} +1 -1
  60. package/dist/storage.d.mts +333 -344
  61. package/dist/storage.d.mts.map +1 -1
  62. package/dist/storage.mjs +39 -40
  63. package/dist/storage.mjs.map +1 -1
  64. package/dist/testing.d.mts +369 -434
  65. package/dist/testing.d.mts.map +1 -1
  66. package/dist/testing.mjs +18 -33
  67. package/dist/testing.mjs.map +1 -1
  68. package/dist/{to-blob-RPqMBuft.mjs → to-blob-Bqu7bmlE.mjs} +2 -3
  69. package/dist/{to-blob-RPqMBuft.mjs.map → to-blob-Bqu7bmlE.mjs.map} +1 -1
  70. package/dist/types-Z4abDJfK.d.mts +501 -0
  71. package/dist/types-Z4abDJfK.d.mts.map +1 -0
  72. package/dist/universes.d.mts +619 -436
  73. package/dist/universes.d.mts.map +1 -1
  74. package/dist/universes.mjs +432 -79
  75. package/dist/universes.mjs.map +1 -1
  76. package/dist/{validation-B_Zs1So2.mjs → validation-kaTLLAD1.mjs} +3 -4
  77. package/dist/{validation-B_Zs1So2.mjs.map → validation-kaTLLAD1.mjs.map} +1 -1
  78. package/dist/wire-DDG87I-d.d.mts +39 -0
  79. package/dist/wire-DDG87I-d.d.mts.map +1 -0
  80. package/package.json +15 -14
  81. package/dist/capacity-admission-IDO3fcUC.d.mts +0 -369
  82. package/dist/capacity-admission-IDO3fcUC.d.mts.map +0 -1
  83. package/dist/data.generated-B2ceLfSn.d.mts.map +0 -1
  84. package/dist/network-error-DR9FX5hb.mjs.map +0 -1
  85. package/dist/polling-helpers-CoVhsC33.mjs.map +0 -1
  86. package/dist/resource-client-B6NeFXUv.d.mts +0 -164
  87. package/dist/resource-client-B6NeFXUv.d.mts.map +0 -1
  88. package/dist/resource-client-rqTMkBeR.mjs.map +0 -1
  89. package/dist/retry-BlX4tUnT.mjs.map +0 -1
  90. package/dist/retry-war_-9tb.d.mts +0 -373
  91. package/dist/retry-war_-9tb.d.mts.map +0 -1
  92. package/dist/types-CvYh4SPC.d.mts +0 -386
  93. package/dist/types-CvYh4SPC.d.mts.map +0 -1
  94. package/dist/wire-D3K-a-UP.d.mts +0 -37
  95. package/dist/wire-D3K-a-UP.d.mts.map +0 -1
package/dist/badges.d.mts CHANGED
@@ -1,35 +1,36 @@
1
- import { f as Result, m as OpenCloudError, s as OpenCloudClientOptions, u as RequestOptions } from "./types-CvYh4SPC.mjs";
2
- import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-B2ceLfSn.mjs";
3
-
4
- //#region src/domains/badges/badges/types.d.ts
1
+ import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-B4Fztv_7.mjs";
2
+ import { c as OpenCloudClientOptions, d as RequestOptions, g as OpenCloudError, m as Result, p as Page } from "./types-Z4abDJfK.mjs";
5
3
  /**
6
- * Awarder kind for a badge. The Roblox API only awards badges from a
7
- * `Place`, so the wire enum carries a single value; the public type
8
- * preserves the string label so future awarder kinds can be added
9
- * without a breaking change.
10
- *
11
- * @since 0.1.0
12
- */
4
+ * Awarder kind for a badge. The Roblox API only awards badges from a
5
+ * `Place`, so the wire enum carries a single value; the public type
6
+ * preserves the string label so future awarder kinds can be added
7
+ * without a breaking change.
8
+ *
9
+ * @since 0.1.0
10
+ */
13
11
  type BadgeAwarderType = "Place";
14
12
  /**
15
- * The entity that awards a badge. Always a place at present; the
16
- * `id` is the awarding place's ID and `name` its display name.
17
- *
18
- * @since 0.1.0
19
- */
13
+ * The entity that awards a badge. Always a place at present; the
14
+ * `id` is the awarding place's ID and `name` its display name.
15
+ *
16
+ * @since 0.1.0
17
+ */
20
18
  interface BadgeAwarder {
21
19
  /** Stringified ID of the awarding entity. */
22
20
  readonly id: string;
23
- /** Display name of the awarding entity. */
24
- readonly name: string;
21
+ /**
22
+ * Display name of the awarding entity, or `undefined` when the
23
+ * response omits it, as the create response does.
24
+ */
25
+ readonly name: string | undefined;
25
26
  /** Kind of awarding entity. Currently always `"Place"`. */
26
27
  readonly type: BadgeAwarderType;
27
28
  }
28
29
  /**
29
- * Award statistics for a badge.
30
- *
31
- * @since 0.1.0
32
- */
30
+ * Award statistics for a badge.
31
+ *
32
+ * @since 0.1.0
33
+ */
33
34
  interface BadgeStatistics {
34
35
  /** Total number of times the badge has been awarded. */
35
36
  readonly awardedCount: number;
@@ -39,16 +40,16 @@ interface BadgeStatistics {
39
40
  readonly winRatePercentage: number;
40
41
  }
41
42
  /**
42
- * Source of funds for the Robux fee charged on badge creation.
43
- *
44
- * @since 0.1.0
45
- */
43
+ * Source of funds for the Robux fee charged on badge creation.
44
+ *
45
+ * @since 0.1.0
46
+ */
46
47
  type BadgePaymentSource = "Group" | "User";
47
48
  /**
48
- * Parameters for creating a new badge under a universe.
49
- *
50
- * @since 0.1.0
51
- */
49
+ * Parameters for creating a new badge under a universe.
50
+ *
51
+ * @since 0.1.0
52
+ */
52
53
  interface CreateBadgeParameters {
53
54
  /** Display name of the new badge. */
54
55
  readonly name: string;
@@ -56,25 +57,28 @@ interface CreateBadgeParameters {
56
57
  readonly description?: string;
57
58
  /** Optional confirmation of the Robux cost the caller expects to pay. */
58
59
  readonly expectedCost?: number;
59
- /** Icon image to upload as the badge's source-language icon. */
60
- readonly icon: Blob | Uint8Array;
60
+ /**
61
+ * Icon image to upload as the badge's source-language icon. When
62
+ * omitted, Roblox gives the badge its default badge icon.
63
+ */
64
+ readonly icon?: Blob | Uint8Array;
61
65
  /** Whether the badge should be created in the active state. */
62
66
  readonly isActive?: boolean;
63
67
  /**
64
- * Account that funds the badge creation fee. Defaults to user funds
65
- * server-side.
66
- */
68
+ * Account that funds the badge creation fee. Defaults to user funds
69
+ * server-side.
70
+ */
67
71
  readonly paymentSource?: BadgePaymentSource;
68
72
  /** Stringified ID of the universe that owns the badge. */
69
73
  readonly universeId: string;
70
74
  }
71
75
  /**
72
- * Parameters for partially updating an existing badge. Every field
73
- * except the identifier is optional; omitted fields are not included
74
- * in the JSON body so the server leaves their current values untouched.
75
- *
76
- * @since 0.1.0
77
- */
76
+ * Parameters for partially updating an existing badge. Every field
77
+ * except the identifier is optional; omitted fields are not included
78
+ * in the JSON body so the server leaves their current values untouched.
79
+ *
80
+ * @since 0.1.0
81
+ */
78
82
  interface UpdateBadgeParameters {
79
83
  /** Optional new source-language display name. */
80
84
  readonly name?: string;
@@ -86,12 +90,12 @@ interface UpdateBadgeParameters {
86
90
  readonly enabled?: boolean;
87
91
  }
88
92
  /**
89
- * A Roblox badge as exposed to SDK consumers. Fields use DX-friendly
90
- * names and types (stringified IDs, `Date` timestamps) rather than the
91
- * raw wire representation.
92
- *
93
- * @since 0.1.0
94
- */
93
+ * A Roblox badge as exposed to SDK consumers. Fields use DX-friendly
94
+ * names and types (stringified IDs, `Date` timestamps) rather than the
95
+ * raw wire representation.
96
+ *
97
+ * @since 0.1.0
98
+ */
95
99
  interface Badge {
96
100
  /** Stringified badge ID. The API returns an int64; always use this. */
97
101
  readonly id: string;
@@ -104,64 +108,123 @@ interface Badge {
104
108
  /** Source-language description shown when no localized override applies. */
105
109
  readonly description: string;
106
110
  /**
107
- * Resolved description for the requesting locale, or the source
108
- * description.
109
- */
111
+ * Resolved description for the requesting locale, or the source
112
+ * description.
113
+ */
110
114
  readonly displayDescription: string;
111
115
  /**
112
- * Resolved icon image asset ID for the requesting locale; `undefined` when
113
- * no icon is uploaded.
114
- */
116
+ * Resolved icon image asset ID for the requesting locale; `undefined` when
117
+ * no icon is uploaded.
118
+ */
115
119
  readonly displayIconImageId: string | undefined;
116
120
  /** Resolved name for the requesting locale, or the source name. */
117
121
  readonly displayName: string;
118
122
  /**
119
- * Whether the badge is currently active. Disabled badges cannot be
120
- * awarded.
121
- */
123
+ * Whether the badge is currently active. Disabled badges cannot be
124
+ * awarded.
125
+ */
122
126
  readonly enabled: boolean;
123
127
  /**
124
- * Source-language icon image asset ID; `undefined` when no icon is
125
- * uploaded.
126
- */
128
+ * Source-language icon image asset ID; `undefined` when no icon is
129
+ * uploaded.
130
+ */
127
131
  readonly iconImageId: string | undefined;
128
132
  /** Award statistics for the badge. */
129
133
  readonly statistics: BadgeStatistics;
130
134
  /** ISO timestamp of the most recent update, as a `Date`. */
131
135
  readonly updatedAt: Date;
132
136
  }
133
- //#endregion
134
- //#region src/domains/game-internationalization/badge-icon/types.d.ts
135
137
  /**
136
- * Parameters for uploading or replacing the per-locale icon registered
137
- * against a badge. A subsequent upload for the same `(badgeId, languageCode)`
138
- * pair replaces the existing icon for that locale. Source-language icons
139
- * are managed through `BadgesClient.uploadIcon`.
140
- *
141
- * @since 0.1.0
142
- */
138
+ * The universe that awards a badge, as the badge read endpoints report it.
139
+ *
140
+ * @since 0.5.0
141
+ */
142
+ interface BadgeAwardingUniverse {
143
+ /** Stringified universe ID. */
144
+ readonly id: string;
145
+ /** Universe display name. */
146
+ readonly name: string;
147
+ /** Stringified ID of the universe's root place. */
148
+ readonly rootPlaceId: string;
149
+ }
150
+ /**
151
+ * A badge as the unauthenticated read endpoints return it. These endpoints
152
+ * name the awarding universe instead of the awarding place, so this shape
153
+ * carries `awardingUniverse` where {@link Badge} carries `awarder`.
154
+ *
155
+ * @since 0.5.0
156
+ */
157
+ interface BadgeDetails extends Pick<Badge, Exclude<keyof Badge, "awarder">> {
158
+ /** Universe that awards the badge. */
159
+ readonly awardingUniverse: BadgeAwardingUniverse;
160
+ }
161
+ /**
162
+ * Page sizes the badge list endpoint accepts.
163
+ *
164
+ * @since 0.5.0
165
+ */
166
+ type BadgePageSize = 10 | 25 | 50 | 100;
167
+ /**
168
+ * Parameters for listing the badges of a universe. Pass the returned
169
+ * `nextPageToken` as `pageToken` until it is undefined.
170
+ *
171
+ * @since 0.5.0
172
+ */
173
+ interface ListBadgesParameters {
174
+ /** Optional page size; Roblox defaults to 10. */
175
+ readonly pageSize?: BadgePageSize;
176
+ /** Cursor returned by the previous page. */
177
+ readonly pageToken?: string;
178
+ /** Stringified universe ID. */
179
+ readonly universeId: string;
180
+ }
181
+ /**
182
+ * Parameters for reading one badge.
183
+ *
184
+ * @since 0.5.0
185
+ */
186
+ interface GetBadgeParameters {
187
+ /** Stringified ID of the badge to read. */
188
+ readonly badgeId: string;
189
+ }
190
+ /**
191
+ * Parameters for reading how many badges a universe can still create free
192
+ * of charge today.
193
+ *
194
+ * @since 0.4.0
195
+ */
196
+ interface GetFreeBadgeQuotaParameters {
197
+ /** Stringified ID of the universe whose free badge quota is read. */
198
+ readonly universeId: string;
199
+ }
200
+ /**
201
+ * Parameters for uploading or replacing the per-locale icon registered
202
+ * against a badge. A subsequent upload for the same `(badgeId, languageCode)`
203
+ * pair replaces the existing icon for that locale. Source-language icons
204
+ * are managed through `BadgesClient.uploadIcon`.
205
+ *
206
+ * @since 0.1.0
207
+ */
143
208
  interface UploadBadgeIconLocalizationParameters {
144
209
  /** Stringified ID of the badge whose icon is being uploaded. */
145
210
  readonly badgeId: string;
146
211
  /** Image bytes to upload. PNG and JPEG are accepted by the server. */
147
212
  readonly image: Blob | Uint8Array;
148
213
  /**
149
- * Roblox wire form the icon is being uploaded for. Either the
150
- * Language form (e.g. `en`, `fil`, `zh-hans`) or the Locale form
151
- * (e.g. `en_us`, `pt_br`, `ar_001`).
152
- */
214
+ * Roblox wire form the icon is being uploaded for. Either the
215
+ * Language form (e.g. `en`, `fil`, `zh-hans`) or the Locale form
216
+ * (e.g. `en_us`, `pt_br`, `ar_001`).
217
+ */
153
218
  readonly languageCode: RobloxLanguageCode | RobloxLocale;
154
219
  }
155
- //#endregion
156
- //#region src/domains/game-internationalization/badge-name-description/types.d.ts
157
220
  /**
158
- * Parameters for updating the per-locale name and/or description registered
159
- * against a badge. Both `name` and `description` are optional; fields omitted
160
- * from the call are not included in the JSON body so the server leaves the
161
- * existing value for that locale untouched.
162
- *
163
- * @since 0.1.0
164
- */
221
+ * Parameters for updating the per-locale name and/or description registered
222
+ * against a badge. Both `name` and `description` are optional; fields omitted
223
+ * from the call are not included in the JSON body so the server leaves the
224
+ * existing value for that locale untouched.
225
+ *
226
+ * @since 0.1.0
227
+ */
165
228
  interface UpdateBadgeNameDescriptionParameters {
166
229
  /** Replacement display name for the supplied locale. */
167
230
  readonly name?: string;
@@ -170,146 +233,246 @@ interface UpdateBadgeNameDescriptionParameters {
170
233
  /** Replacement description for the supplied locale. */
171
234
  readonly description?: string;
172
235
  /**
173
- * Roblox wire form being updated. Either the Language form (e.g.
174
- * `en`, `fil`, `zh-hans`) or the Locale form (e.g. `en_us`, `pt_br`,
175
- * `ar_001`).
176
- */
236
+ * Roblox wire form being updated. Either the Language form (e.g.
237
+ * `en`, `fil`, `zh-hans`) or the Locale form (e.g. `en_us`, `pt_br`,
238
+ * `ar_001`).
239
+ */
177
240
  readonly languageCode: RobloxLanguageCode | RobloxLocale;
178
241
  }
179
- //#endregion
180
- //#region src/domains/publish/badge-icon/types.d.ts
181
242
  /**
182
- * Parameters for uploading or replacing the source-language icon
183
- * registered against a badge. A subsequent upload for the same badge
184
- * replaces the existing source icon; per-locale icon overlays live
185
- * under a separate `legacy-game-internationalization` endpoint and
186
- * are managed through `BadgesClient.localization.uploadIcon`.
187
- *
188
- * @since 0.1.0
189
- */
243
+ * Parameters for uploading or replacing the source-language icon
244
+ * registered against a badge. A subsequent upload for the same badge
245
+ * replaces the existing source icon; per-locale icon overlays live
246
+ * under a separate `legacy-game-internationalization` endpoint and
247
+ * are managed through `BadgesClient.localization.uploadIcon`.
248
+ *
249
+ * @since 0.1.0
250
+ */
190
251
  interface UploadBadgeIconParameters {
191
252
  /** Stringified ID of the badge whose icon is being uploaded. */
192
253
  readonly badgeId: string;
193
254
  /** Image bytes to upload. PNG and JPEG are accepted by the server. */
194
255
  readonly icon: Blob | Uint8Array;
195
256
  }
196
- //#endregion
197
- //#region src/resources/badges/client.d.ts
257
+ /**
258
+ * The source-language icon a badge icon upload stored.
259
+ *
260
+ * @since 0.4.0
261
+ */
262
+ interface UploadedBadgeIcon {
263
+ /** Stringified asset ID of the uploaded icon image. */
264
+ readonly iconImageId: string;
265
+ }
198
266
  interface BadgeLocalizationHandle {
199
267
  /**
200
- * Updates the per-locale display name and/or description registered against
201
- * a badge. Either `name`, `description`, or both may be supplied; omitted
202
- * fields are not forwarded so the server leaves the existing value for
203
- * that locale untouched. Mirrors the upstream `200 OK` echo body as
204
- * `undefined` data.
205
- *
206
- * @param parameters - Badge and language identifiers plus the optional
207
- * replacement values.
208
- * @param options - Optional per-request overrides.
209
- * @returns A success {@link Result} with no payload, or the
210
- * {@link OpenCloudError} that caused the request to fail.
211
- */
268
+ * Updates the per-locale display name and/or description registered against
269
+ * a badge. Either `name`, `description`, or both may be supplied; omitted
270
+ * fields are not forwarded so the server leaves the existing value for
271
+ * that locale untouched. Mirrors the upstream `200 OK` echo body as
272
+ * `undefined` data.
273
+ *
274
+ * @param parameters - Badge and language identifiers plus the optional
275
+ * replacement values.
276
+ * @param options - Optional per-request overrides.
277
+ * @returns A success {@link Result} with no payload, or the
278
+ * {@link OpenCloudError} that caused the request to fail.
279
+ */
212
280
  updateNameDescription: (parameters: UpdateBadgeNameDescriptionParameters, options?: RequestOptions) => Promise<Result<undefined, OpenCloudError>>;
213
281
  /**
214
- * Uploads or replaces the per-locale icon for a badge. A subsequent
215
- * upload for the same `(badgeId, languageCode)` pair replaces the
216
- * existing icon for that locale. Does not retry on 5xx so a duplicate
217
- * upload cannot be created if the server fails mid-write. Source-language
218
- * icons remain on {@link BadgesClient.uploadIcon}.
219
- *
220
- * No default request timeout applies to this upload; pass `options.timeout`
221
- * to set a per-call deadline.
222
- *
223
- * @param parameters - Badge and language identifiers plus the image bytes
224
- * to upload.
225
- * @param options - Optional per-request overrides.
226
- * @returns A success {@link Result} with no payload, or the
227
- * {@link OpenCloudError} that caused the request to fail.
228
- */
282
+ * Uploads or replaces the per-locale icon for a badge. A subsequent
283
+ * upload for the same `(badgeId, languageCode)` pair replaces the
284
+ * existing icon for that locale. Does not retry on 5xx so a duplicate
285
+ * upload cannot be created if the server fails mid-write. Source-language
286
+ * icons remain on {@link BadgesClient.uploadIcon}.
287
+ *
288
+ * No default request timeout applies to this upload; pass `options.timeout`
289
+ * to set a per-call deadline.
290
+ *
291
+ * @param parameters - Badge and language identifiers plus the image bytes
292
+ * to upload.
293
+ * @param options - Optional per-request overrides.
294
+ * @returns A success {@link Result} with no payload, or the
295
+ * {@link OpenCloudError} that caused the request to fail.
296
+ */
229
297
  uploadIcon: (parameters: UploadBadgeIconLocalizationParameters, options?: RequestOptions) => Promise<Result<undefined, OpenCloudError>>;
230
298
  }
231
299
  /**
232
- * Public client for the Roblox Open Cloud Badges API. Covers programmatic
233
- * badge creation under a universe, partial updates of badge configuration
234
- * (`name`, `description`, `enabled`), and source-language icon uploads.
235
- *
236
- * Wires the request builders, the injected
237
- * {@link OpenCloudClientOptions.httpClient}, and response parsers into a
238
- * single ergonomic surface. Every method returns a {@link Result} so
239
- * callers handle failure explicitly; no thrown {@link OpenCloudError}
240
- * ever escapes the client.
241
- *
242
- * @since 0.1.0
243
- *
244
- * @example
245
- *
246
- * ```ts
247
- * import { BadgesClient } from "@bedrock-rbx/ocale/badges";
248
- *
249
- * const client = new BadgesClient({ apiKey: "your-key" });
250
- * expect(client).toBeInstanceOf(BadgesClient);
251
- * ```
252
- */
253
- declare class BadgesClient {
300
+ * Public client for the Roblox Open Cloud Badges API. Covers programmatic
301
+ * badge creation under a universe, partial updates of badge configuration
302
+ * (`name`, `description`, `enabled`), and source-language icon uploads.
303
+ *
304
+ * Wires the request builders, the injected
305
+ * {@link OpenCloudClientOptions.httpClient}, and response parsers into a
306
+ * single ergonomic surface. Every method returns a {@link Result} so
307
+ * callers handle failure explicitly; no thrown {@link OpenCloudError}
308
+ * ever escapes the client.
309
+ *
310
+ * @since 0.1.0
311
+ *
312
+ * @example
313
+ *
314
+ * ```ts
315
+ * import { BadgesClient } from "@bedrock-rbx/ocale/badges";
316
+ *
317
+ * const client = new BadgesClient({ credential: { apiKey: "your-key", kind: "apiKey" } });
318
+ * expect(client).toBeInstanceOf(BadgesClient);
319
+ * ```
320
+ */
321
+ export declare class BadgesClient {
254
322
  #private;
255
323
  /**
256
- * Operation Group exposing per-locale localization Operations
257
- * (`updateNameDescription`, `uploadIcon`) backed by the
258
- * `legacy-game-internationalization` domain. Source-language values
259
- * remain on {@link BadgesClient.update} and
260
- * {@link BadgesClient.uploadIcon}; methods on this group set per-locale
261
- * overlays on top. Shares the parent client's HTTP, rate-limit, and
262
- * retry plumbing.
263
- */
324
+ * Operation Group exposing per-locale localization Operations
325
+ * (`updateNameDescription`, `uploadIcon`) backed by the
326
+ * `legacy-game-internationalization` domain. Source-language values
327
+ * remain on {@link BadgesClient.update} and
328
+ * {@link BadgesClient.uploadIcon}; methods on this group set per-locale
329
+ * overlays on top. Shares the parent client's HTTP, rate-limit, and
330
+ * retry plumbing.
331
+ */
264
332
  readonly localization: BadgeLocalizationHandle;
265
333
  /**
266
- * Creates a new {@link BadgesClient}. Configuration is frozen on
267
- * construction; per-request overrides are accepted on each method.
268
- *
269
- * @param options - Client-level configuration including the API key.
270
- */
334
+ * Creates a new {@link BadgesClient}. Configuration is frozen on
335
+ * construction; per-request overrides are accepted on each method.
336
+ *
337
+ * @param options - Client-level configuration including the API key.
338
+ */
271
339
  constructor(options: OpenCloudClientOptions);
272
340
  /**
273
- * Creates a new badge under the supplied universe.
274
- *
275
- * No default request timeout applies to this upload; pass `options.timeout`
276
- * to set a per-call deadline.
277
- *
278
- * @param parameters - Creation fields including the universe, name, and
279
- * icon image.
280
- * @param options - Optional per-request overrides.
281
- * @returns A {@link Result} wrapping the parsed {@link Badge} or the
282
- * {@link OpenCloudError} that caused the request to fail.
283
- */
341
+ * Creates a new badge under the supplied universe.
342
+ *
343
+ * No default request timeout applies to this upload; pass `options.timeout`
344
+ * to set a per-call deadline.
345
+ *
346
+ * A create whose `expectedCost` differs from the actual cost fails with a
347
+ * `BadgeCostMismatchError` and is not charged; with `expectedCost: 0`
348
+ * that means the universe's free badge quota is spent for today.
349
+ *
350
+ * @param parameters - Creation fields including the universe, name, and
351
+ * icon image.
352
+ * @param options - Optional per-request overrides.
353
+ * @returns A {@link Result} wrapping the parsed {@link Badge} or the
354
+ * {@link OpenCloudError} that caused the request to fail.
355
+ */
284
356
  create(parameters: CreateBadgeParameters, options?: RequestOptions): Promise<Result<Badge, OpenCloudError>>;
285
357
  /**
286
- * Partially updates a badge's configuration. Mirrors the upstream
287
- * `200 OK` empty response: a successful update yields `undefined`
288
- * data. Only fields explicitly provided are forwarded to the server,
289
- * so omitted fields keep their current values.
290
- *
291
- * @param parameters - Identifier plus the fields to update.
292
- * @param options - Optional per-request overrides.
293
- * @returns A success {@link Result} with no payload, or the
294
- * {@link OpenCloudError} that caused the request to fail.
295
- */
358
+ * Reads one badge, enabled or disabled. A disabled badge comes back with
359
+ * `enabled: false`; {@link BadgesClient.list} does not return it.
360
+ *
361
+ * The read is unauthenticated: it sends no credential and is served from
362
+ * `https://badges.roblox.com`, so the client `baseUrl` does not apply.
363
+ * Roblox allows 600 reads per minute per caller.
364
+ *
365
+ * @since 0.5.0
366
+ * @param parameters - The badge to read.
367
+ * @param options - Optional per-request overrides.
368
+ * @returns A {@link Result} wrapping the parsed {@link BadgeDetails}, or the
369
+ * {@link OpenCloudError} that caused the request to fail.
370
+ */
371
+ get(parameters: GetBadgeParameters, options?: RequestOptions): Promise<Result<BadgeDetails, OpenCloudError>>;
372
+ /**
373
+ * Reads the list price in Robux of one badge create beyond the free
374
+ * quota. The price is the same for every universe; it is not the cost
375
+ * of the next create, which is free while
376
+ * {@link BadgesClient.getFreeQuota} is above zero. Pass the price as
377
+ * `expectedCost` on {@link BadgesClient.create} to pay for a create.
378
+ *
379
+ * The read is unauthenticated: it sends no credential and is served from
380
+ * `https://badges.roblox.com`, so the client `baseUrl` does not apply.
381
+ * Roblox allows 100 reads per minute per caller.
382
+ *
383
+ * @since 0.5.0
384
+ * @param options - Optional per-request overrides.
385
+ * @returns A {@link Result} wrapping the badge creation price in Robux,
386
+ * or the {@link OpenCloudError} that caused the request to fail.
387
+ *
388
+ * @example
389
+ *
390
+ * ```ts
391
+ * import { BadgesClient } from "@bedrock-rbx/ocale/badges";
392
+ *
393
+ * const client = new BadgesClient({
394
+ * credential: { kind: "none" },
395
+ * httpClient: {
396
+ * request: async () => ({
397
+ * data: { body: { badgeCreationPrice: 100 }, headers: {}, status: 200 },
398
+ * success: true,
399
+ * }),
400
+ * },
401
+ * });
402
+ *
403
+ * return client.getCreationPrice().then((price) => {
404
+ * expect(price).toStrictEqual({ data: 100, success: true });
405
+ * });
406
+ * ```
407
+ */
408
+ getCreationPrice(options?: RequestOptions): Promise<Result<number, OpenCloudError>>;
409
+ /**
410
+ * Reads how many badges the universe can still create free of charge
411
+ * today. Each create within the quota lowers it by one. The quota resets
412
+ * daily at 00:00 UTC. Roblox answers for any universe ID, existing or not.
413
+ *
414
+ * The read is unauthenticated: it sends no credential and is served from
415
+ * `https://badges.roblox.com`, so the client `baseUrl` does not apply.
416
+ * Roblox allows 60 reads per minute per caller. A 429 waits until the
417
+ * reported `x-ratelimit-reset` before it retries.
418
+ *
419
+ * @since 0.4.0
420
+ * @param parameters - The universe to read.
421
+ * @param options - Optional per-request overrides.
422
+ * @returns A {@link Result} wrapping the free badges left today, or the
423
+ * {@link OpenCloudError} that caused the request to fail.
424
+ */
425
+ getFreeQuota(parameters: GetFreeBadgeQuotaParameters, options?: RequestOptions): Promise<Result<number, OpenCloudError>>;
426
+ /**
427
+ * Lists one page of a universe's enabled badges. Omit
428
+ * `pageToken` for the first page, then pass the returned `nextPageToken`
429
+ * until it is undefined.
430
+ *
431
+ * This list hides disabled badges. A badge leaves the list as soon as
432
+ * it is disabled, but {@link BadgesClient.get} still returns it, with
433
+ * `enabled: false`. Use {@link BadgesClient.get} to see a disabled badge,
434
+ * for example a tracked badge that someone disabled. A page can hold
435
+ * fewer items than `pageSize` and still have a next page, so page until
436
+ * `nextPageToken` is undefined.
437
+ *
438
+ * The read is unauthenticated: it sends no credential and is served from
439
+ * `https://badges.roblox.com`, so the client `baseUrl` does not apply.
440
+ * Roblox allows 100 pages per minute per caller.
441
+ *
442
+ * @since 0.5.0
443
+ * @param parameters - Universe ID and optional paging fields.
444
+ * @param options - Optional per-request overrides.
445
+ * @returns A {@link Result} wrapping the badge page, or the
446
+ * {@link OpenCloudError} that caused the request to fail.
447
+ */
448
+ list(parameters: ListBadgesParameters, options?: RequestOptions): Promise<Result<Page<BadgeDetails>, OpenCloudError>>;
449
+ /**
450
+ * Partially updates a badge's configuration. Mirrors the upstream
451
+ * `200 OK` empty response: a successful update yields `undefined`
452
+ * data. Only fields explicitly provided are forwarded to the server,
453
+ * so omitted fields keep their current values.
454
+ *
455
+ * @param parameters - Identifier plus the fields to update.
456
+ * @param options - Optional per-request overrides.
457
+ * @returns A success {@link Result} with no payload, or the
458
+ * {@link OpenCloudError} that caused the request to fail.
459
+ */
296
460
  update(parameters: UpdateBadgeParameters, options?: RequestOptions): Promise<Result<undefined, OpenCloudError>>;
297
461
  /**
298
- * Uploads or replaces the source-language icon registered against a
299
- * badge. A subsequent upload for the same badge replaces the
300
- * existing source icon. Does not retry on 5xx so a duplicate icon
301
- * upload cannot be created if the server fails mid-write.
302
- *
303
- * No default request timeout applies to this upload; pass `options.timeout`
304
- * to set a per-call deadline.
305
- *
306
- * @param parameters - Identifier plus the image bytes to upload.
307
- * @param options - Optional per-request overrides.
308
- * @returns A success {@link Result} with no payload, or the
309
- * {@link OpenCloudError} that caused the request to fail.
310
- */
311
- uploadIcon(parameters: UploadBadgeIconParameters, options?: RequestOptions): Promise<Result<undefined, OpenCloudError>>;
462
+ * Uploads or replaces the source-language icon registered against a
463
+ * badge. A subsequent upload for the same badge replaces the
464
+ * existing source icon. Does not retry on 5xx so a duplicate icon
465
+ * upload cannot be created if the server fails mid-write.
466
+ *
467
+ * No default request timeout applies to this upload; pass `options.timeout`
468
+ * to set a per-call deadline.
469
+ *
470
+ * @param parameters - Identifier plus the image bytes to upload.
471
+ * @param options - Optional per-request overrides.
472
+ * @returns A {@link Result} wrapping the uploaded icon's asset ID, or the
473
+ * {@link OpenCloudError} that caused the request to fail.
474
+ */
475
+ uploadIcon(parameters: UploadBadgeIconParameters, options?: RequestOptions): Promise<Result<UploadedBadgeIcon, OpenCloudError>>;
312
476
  }
313
- //#endregion
314
- export { type Badge, type BadgeAwarder, type BadgeAwarderType, type BadgePaymentSource, type BadgeStatistics, BadgesClient, type CreateBadgeParameters, type UpdateBadgeNameDescriptionParameters, type UpdateBadgeParameters, type UploadBadgeIconLocalizationParameters, type UploadBadgeIconParameters };
477
+ export type { Badge, BadgeAwarder, BadgeAwarderType, BadgeAwardingUniverse, BadgeDetails, BadgePageSize, BadgePaymentSource, BadgeStatistics, CreateBadgeParameters, GetBadgeParameters, GetFreeBadgeQuotaParameters, ListBadgesParameters, UpdateBadgeNameDescriptionParameters, UpdateBadgeParameters, UploadBadgeIconLocalizationParameters, UploadBadgeIconParameters, UploadedBadgeIcon };
315
478
  //# sourceMappingURL=badges.d.mts.map