import { f as Result, m as OpenCloudError, s as OpenCloudClientOptions, u as RequestOptions } from "./types-C3Egi37J.mjs"; import { i as RobloxLocale, r as RobloxLanguageCode } from "./data.generated-B2ceLfSn.mjs"; //#region src/domains/badges/badges/types.d.ts /** * Awarder kind for a badge. The Roblox API only awards badges from a * `Place`, so the wire enum carries a single value; the public type * preserves the string label so future awarder kinds can be added * without a breaking change. * * @since 0.1.0 */ type BadgeAwarderType = "Place"; /** * The entity that awards a badge. Always a place at present; the * `id` is the awarding place's ID and `name` its display name. * * @since 0.1.0 */ interface BadgeAwarder { /** Stringified ID of the awarding entity. */ readonly id: string; /** Display name of the awarding entity. */ readonly name: string; /** Kind of awarding entity. Currently always `"Place"`. */ readonly type: BadgeAwarderType; } /** * Award statistics for a badge. * * @since 0.1.0 */ interface BadgeStatistics { /** Total number of times the badge has been awarded. */ readonly awardedCount: number; /** Number of times the badge has been awarded in the past day. */ readonly pastDayAwardedCount: number; /** Win rate, as a percentage between 0 and 100. */ readonly winRatePercentage: number; } /** * Source of funds for the Robux fee charged on badge creation. * * @since 0.1.0 */ type BadgePaymentSource = "Group" | "User"; /** * Parameters for creating a new badge under a universe. * * @since 0.1.0 */ interface CreateBadgeParameters { /** Display name of the new badge. */ readonly name: string; /** Optional source-language description. */ readonly description?: string; /** Optional confirmation of the Robux cost the caller expects to pay. */ readonly expectedCost?: number; /** Icon image to upload as the badge's source-language icon. */ readonly icon: Blob | Uint8Array; /** Whether the badge should be created in the active state. */ readonly isActive?: boolean; /** * Account that funds the badge creation fee. Defaults to user funds * server-side. */ readonly paymentSource?: BadgePaymentSource; /** Stringified ID of the universe that owns the badge. */ readonly universeId: string; } /** * Parameters for partially updating an existing badge. Every field * except the identifier is optional; omitted fields are not included * in the JSON body so the server leaves their current values untouched. * * @since 0.1.0 */ interface UpdateBadgeParameters { /** Optional new source-language display name. */ readonly name?: string; /** Stringified ID of the badge to update. */ readonly badgeId: string; /** Optional new source-language description. */ readonly description?: string; /** Optional new enabled flag. */ readonly enabled?: boolean; } /** * A Roblox badge as exposed to SDK consumers. Fields use DX-friendly * names and types (stringified IDs, `Date` timestamps) rather than the * raw wire representation. * * @since 0.1.0 */ interface Badge { /** Stringified badge ID. The API returns an int64; always use this. */ readonly id: string; /** Source-language name shown when no localized override applies. */ readonly name: string; /** Awarding entity for the badge. */ readonly awarder: BadgeAwarder; /** ISO timestamp at which the badge was created, as a `Date`. */ readonly createdAt: Date; /** Source-language description shown when no localized override applies. */ readonly description: string; /** * Resolved description for the requesting locale, or the source * description. */ readonly displayDescription: string; /** * Resolved icon image asset ID for the requesting locale; `undefined` when * no icon is uploaded. */ readonly displayIconImageId: string | undefined; /** Resolved name for the requesting locale, or the source name. */ readonly displayName: string; /** * Whether the badge is currently active. Disabled badges cannot be * awarded. */ readonly enabled: boolean; /** * Source-language icon image asset ID; `undefined` when no icon is * uploaded. */ readonly iconImageId: string | undefined; /** Award statistics for the badge. */ readonly statistics: BadgeStatistics; /** ISO timestamp of the most recent update, as a `Date`. */ readonly updatedAt: Date; } //#endregion //#region src/domains/game-internationalization/badge-icon/types.d.ts /** * Parameters for uploading or replacing the per-locale icon registered * against a badge. A subsequent upload for the same `(badgeId, languageCode)` * pair replaces the existing icon for that locale. Source-language icons * are managed through `BadgesClient.uploadIcon`. * * @since 0.1.0 */ interface UploadBadgeIconLocalizationParameters { /** Stringified ID of the badge whose icon is being uploaded. */ readonly badgeId: string; /** Image bytes to upload. PNG and JPEG are accepted by the server. */ readonly image: Blob | Uint8Array; /** * Roblox wire form the icon is being uploaded for. Either the * Language form (e.g. `en`, `fil`, `zh-hans`) or the Locale form * (e.g. `en_us`, `pt_br`, `ar_001`). */ readonly languageCode: RobloxLanguageCode | RobloxLocale; } //#endregion //#region src/domains/game-internationalization/badge-name-description/types.d.ts /** * Parameters for updating the per-locale name and/or description registered * against a badge. Both `name` and `description` are optional; fields omitted * from the call are not included in the JSON body so the server leaves the * existing value for that locale untouched. * * @since 0.1.0 */ interface UpdateBadgeNameDescriptionParameters { /** Replacement display name for the supplied locale. */ readonly name?: string; /** Stringified ID of the badge whose localization is being updated. */ readonly badgeId: string; /** Replacement description for the supplied locale. */ readonly description?: string; /** * Roblox wire form being updated. Either the Language form (e.g. * `en`, `fil`, `zh-hans`) or the Locale form (e.g. `en_us`, `pt_br`, * `ar_001`). */ readonly languageCode: RobloxLanguageCode | RobloxLocale; } //#endregion //#region src/domains/publish/badge-icon/types.d.ts /** * Parameters for uploading or replacing the source-language icon * registered against a badge. A subsequent upload for the same badge * replaces the existing source icon; per-locale icon overlays live * under a separate `legacy-game-internationalization` endpoint and * are managed through `BadgesClient.localization.uploadIcon`. * * @since 0.1.0 */ interface UploadBadgeIconParameters { /** Stringified ID of the badge whose icon is being uploaded. */ readonly badgeId: string; /** Image bytes to upload. PNG and JPEG are accepted by the server. */ readonly icon: Blob | Uint8Array; } //#endregion //#region src/resources/badges/client.d.ts interface BadgeLocalizationHandle { /** * Updates the per-locale display name and/or description registered against * a badge. Either `name`, `description`, or both may be supplied; omitted * fields are not forwarded so the server leaves the existing value for * that locale untouched. Mirrors the upstream `200 OK` echo body as * `undefined` data. * * @param parameters - Badge and language identifiers plus the optional * replacement values. * @param options - Optional per-request overrides. * @returns A success {@link Result} with no payload, or the * {@link OpenCloudError} that caused the request to fail. */ updateNameDescription: (parameters: UpdateBadgeNameDescriptionParameters, options?: RequestOptions) => Promise>; /** * Uploads or replaces the per-locale icon for a badge. A subsequent * upload for the same `(badgeId, languageCode)` pair replaces the * existing icon for that locale. Does not retry on 5xx so a duplicate * upload cannot be created if the server fails mid-write. Source-language * icons remain on {@link BadgesClient.uploadIcon}. * * No default request timeout applies to this upload; pass `options.timeout` * to set a per-call deadline. * * @param parameters - Badge and language identifiers plus the image bytes * to upload. * @param options - Optional per-request overrides. * @returns A success {@link Result} with no payload, or the * {@link OpenCloudError} that caused the request to fail. */ uploadIcon: (parameters: UploadBadgeIconLocalizationParameters, options?: RequestOptions) => Promise>; } /** * Public client for the Roblox Open Cloud Badges API. Covers programmatic * badge creation under a universe, partial updates of badge configuration * (`name`, `description`, `enabled`), and source-language icon uploads. * * Wires the request builders, the injected * {@link OpenCloudClientOptions.httpClient}, and response parsers into a * single ergonomic surface. Every method returns a {@link Result} so * callers handle failure explicitly; no thrown {@link OpenCloudError} * ever escapes the client. * * @since 0.1.0 * * @example * * ```ts * import { BadgesClient } from "@bedrock-rbx/ocale/badges"; * * const client = new BadgesClient({ apiKey: "your-key" }); * expect(client).toBeInstanceOf(BadgesClient); * ``` */ declare class BadgesClient { #private; /** * Operation Group exposing per-locale localization Operations * (`updateNameDescription`, `uploadIcon`) backed by the * `legacy-game-internationalization` domain. Source-language values * remain on {@link BadgesClient.update} and * {@link BadgesClient.uploadIcon}; methods on this group set per-locale * overlays on top. Shares the parent client's HTTP, rate-limit, and * retry plumbing. */ readonly localization: BadgeLocalizationHandle; /** * Creates a new {@link BadgesClient}. Configuration is frozen on * construction; per-request overrides are accepted on each method. * * @param options - Client-level configuration including the API key. */ constructor(options: OpenCloudClientOptions); /** * Creates a new badge under the supplied universe. * * No default request timeout applies to this upload; pass `options.timeout` * to set a per-call deadline. * * @param parameters - Creation fields including the universe, name, and * icon image. * @param options - Optional per-request overrides. * @returns A {@link Result} wrapping the parsed {@link Badge} or the * {@link OpenCloudError} that caused the request to fail. */ create(parameters: CreateBadgeParameters, options?: RequestOptions): Promise>; /** * Partially updates a badge's configuration. Mirrors the upstream * `200 OK` empty response: a successful update yields `undefined` * data. Only fields explicitly provided are forwarded to the server, * so omitted fields keep their current values. * * @param parameters - Identifier plus the fields to update. * @param options - Optional per-request overrides. * @returns A success {@link Result} with no payload, or the * {@link OpenCloudError} that caused the request to fail. */ update(parameters: UpdateBadgeParameters, options?: RequestOptions): Promise>; /** * Uploads or replaces the source-language icon registered against a * badge. A subsequent upload for the same badge replaces the * existing source icon. Does not retry on 5xx so a duplicate icon * upload cannot be created if the server fails mid-write. * * No default request timeout applies to this upload; pass `options.timeout` * to set a per-call deadline. * * @param parameters - Identifier plus the image bytes to upload. * @param options - Optional per-request overrides. * @returns A success {@link Result} with no payload, or the * {@link OpenCloudError} that caused the request to fail. */ uploadIcon(parameters: UploadBadgeIconParameters, options?: RequestOptions): Promise>; } //#endregion export { type Badge, type BadgeAwarder, type BadgeAwarderType, type BadgePaymentSource, type BadgeStatistics, BadgesClient, type CreateBadgeParameters, type UpdateBadgeNameDescriptionParameters, type UpdateBadgeParameters, type UploadBadgeIconLocalizationParameters, type UploadBadgeIconParameters }; //# sourceMappingURL=badges.d.mts.map