@wix/auto_sdk_gbp_media-uploads 1.0.0 → 1.0.2
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.
- package/build/cjs/index.js +84 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +16 -0
- package/build/cjs/index.typings.js +84 -0
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +16 -0
- package/build/cjs/meta.js +84 -0
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.mjs +84 -0
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +16 -0
- package/build/es/index.typings.mjs +84 -0
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +16 -0
- package/build/es/meta.mjs +84 -0
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.js +84 -0
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +16 -0
- package/build/internal/cjs/index.typings.js +84 -0
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +16 -0
- package/build/internal/cjs/meta.js +84 -0
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.mjs +84 -0
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +16 -0
- package/build/internal/es/index.typings.mjs +84 -0
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +16 -0
- package/build/internal/es/meta.mjs +84 -0
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/gbp-location-v1-media-upload-media-uploads.universal.ts","../../../src/gbp-location-v1-media-upload-media-uploads.http.ts","../../../src/gbp-location-v1-media-upload-media-uploads.public.ts","../../../src/gbp-location-v1-media-upload-media-uploads.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGbpLocationV1MediaUpload from './gbp-location-v1-media-upload-media-uploads.http.js';\n\n/**\n * One queued photo change on a Google Business Profile location: either an\n * addition or a removal.\n *\n * Photo changes are queued and applied gradually rather than immediately,\n * because Google accepts only about 10 edits per minute per Business Profile.\n *\n * Anything you can read here is either still waiting to be applied or has\n * failed. A change that succeeded leaves nothing behind, so an empty list means\n * the queue finished and everything worked. See `state`.\n */\nexport interface MediaUpload {\n /**\n * Queued change ID.\n * @format GUID\n * @readonly\n */\n _id?: string;\n /**\n * ID of the location this change applies to. This is Google's location\n * identifier.\n * @immutable\n * @minLength 1\n * @maxLength 255\n */\n locationId?: string;\n /**\n * Groups the changes queued by one Bulk Create Media Uploads call. Useful for\n * troubleshooting, since one save can produce more than one batch.\n * @format GUID\n * @readonly\n */\n batchId?: string;\n /**\n * Your own key for this photo: `logo`, `cover`, or `photo:<id>`.\n *\n * Set it to something stable and meaningful to you. It's how a failure is\n * matched back to the photo that caused it, and it's part of what makes a\n * repeated submission a duplicate rather than a second change.\n * @maxLength 255\n */\n slotKey?: string;\n /**\n * Publicly reachable URL Google fetches the image from. Additions only.\n *\n * Keep it reachable well beyond the upload itself. A failure report renders\n * this URL as a thumbnail, possibly weeks later.\n * @maxLength 2048\n */\n sourceUrl?: string;\n /** Where the photo appears on the profile. Additions only. */\n category?: MediaCategoryWithLiterals;\n /** Media type of the photo. Additions only. */\n format?: MediaFormatWithLiterals;\n /** Whether this change adds a photo to the profile or removes one. */\n operation?: MediaUploadOperationWithLiterals;\n /**\n * Position in the order the queue applies changes, assigned by the server.\n *\n * Every removal comes before every addition, because Google rejects new photos\n * on a profile that's already at its limit, so the old ones have to go first.\n * Additions then follow as logo, cover, and gallery in the order given.\n * @readonly\n */\n sequence?: number;\n /**\n * Whether this change is waiting, being applied, or has failed.\n * @readonly\n */\n state?: MediaUploadStateWithLiterals;\n /**\n * How many times this change has been attempted.\n * @readonly\n */\n attempts?: number;\n /**\n * Google's identifier for the photo to remove. Removals only.\n * @maxLength 255\n */\n mediaKey?: string;\n /**\n * Why this change failed. Present only when `state` is `FAILED`.\n * @readonly\n */\n failure?: MediaUploadFailure;\n /**\n * Date and time the change was queued.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the change was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Revision number, incremented on every update.\n * @readonly\n */\n revision?: string;\n}\n\n/**\n * Where a media item is shown on the listing. Mirrors Google's mybusiness v4\n * LocationAssociation.Category.\n */\nexport enum MediaCategory {\n COVER = 'COVER',\n PROFILE = 'PROFILE',\n LOGO = 'LOGO',\n EXTERIOR = 'EXTERIOR',\n INTERIOR = 'INTERIOR',\n PRODUCT = 'PRODUCT',\n AT_WORK = 'AT_WORK',\n FOOD_AND_DRINK = 'FOOD_AND_DRINK',\n MENU = 'MENU',\n COMMON_AREA = 'COMMON_AREA',\n ROOMS = 'ROOMS',\n TEAMS = 'TEAMS',\n ADDITIONAL = 'ADDITIONAL',\n}\n\n/** @enumType */\nexport type MediaCategoryWithLiterals =\n | MediaCategory\n | 'COVER'\n | 'PROFILE'\n | 'LOGO'\n | 'EXTERIOR'\n | 'INTERIOR'\n | 'PRODUCT'\n | 'AT_WORK'\n | 'FOOD_AND_DRINK'\n | 'MENU'\n | 'COMMON_AREA'\n | 'ROOMS'\n | 'TEAMS'\n | 'ADDITIONAL';\n\n/** Format of a media item. Mirrors Google's mybusiness v4 MediaFormat. */\nexport enum MediaFormat {\n PHOTO = 'PHOTO',\n VIDEO = 'VIDEO',\n}\n\n/** @enumType */\nexport type MediaFormatWithLiterals = MediaFormat | 'PHOTO' | 'VIDEO';\n\n/**\n * Whether a queued change adds a photo to the profile or removes one.\n *\n * Removals are edits too and draw on the same per-minute budget as additions,\n * which is why both go through the same queue.\n */\nexport enum MediaUploadOperation {\n /** Add a photo to the profile. */\n CREATE = 'CREATE',\n /** Remove a photo from the profile. */\n DELETE = 'DELETE',\n}\n\n/** @enumType */\nexport type MediaUploadOperationWithLiterals =\n | MediaUploadOperation\n | 'CREATE'\n | 'DELETE';\n\n/**\n * Where a queued photo change is in its lifecycle.\n *\n * There's no state for success. A change that succeeds is removed from the\n * queue, because Google's own media list is the record of what's live. So an\n * empty queue means everything worked, and failures stay until the next\n * submission for that location replaces them or you dismiss them.\n *\n * One consequence is worth knowing: because success leaves nothing behind, an\n * addition that succeeded and one that never ran look the same afterwards. When\n * the queue can't confirm an addition reached Google, it fails the change as\n * `UPLOAD_UNVERIFIED` instead of retrying it, so you don't end up with the same\n * photo twice. Removals carry no such risk and are retried freely.\n */\nexport enum MediaUploadState {\n /** Waiting its turn in the queue. */\n PENDING = 'PENDING',\n /**\n * Being applied to Google now. A change that stays here isn't one that never\n * ran: its outcome isn't known yet.\n */\n UPLOADING = 'UPLOADING',\n /** Failed, and won't be retried. Kept until replaced or dismissed. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type MediaUploadStateWithLiterals =\n | MediaUploadState\n | 'PENDING'\n | 'UPLOADING'\n | 'FAILED';\n\n/** Why a queued photo change failed. */\nexport interface MediaUploadFailure {\n /** Why the change failed, in terms you can show a site owner. */\n reason?: MediaUploadFailureReasonWithLiterals;\n /**\n * Internal, and withheld from public callers.\n *\n * Carries Google's own response text for the failure, which is support\n * diagnostics rather than developer contract. This service already withholds\n * exactly this on public read paths: LocationWithGoogle drops\n * google_response_body and google_error_message on the query path and records\n * them in the visibility events instead, because that path is reachable by\n * public apps. ListMediaUploads is now such a path, so the same rule applies\n * and `reason` is the whole public contract for a failure.\n * @internal\n * @maxLength 5000\n */\n errorMessage?: string;\n}\n\n/**\n * Why a photo change failed, in terms you can show a site owner.\n *\n * This is often the only account of the upload they'll ever see, and they may\n * read it long after the fact, so it's worth surfacing rather than logging.\n */\nexport enum MediaUploadFailureReason {\n /** Below Google's minimum dimensions. */\n IMAGE_TOO_SMALL = 'IMAGE_TOO_SMALL',\n /** Cover/logo ratio outside Google's accepted range. */\n ASPECT_RATIO_REJECTED = 'ASPECT_RATIO_REJECTED',\n /** File type Google will not accept. */\n FORMAT_UNSUPPORTED = 'FORMAT_UNSUPPORTED',\n /** Google could not fetch the image URL. */\n SOURCE_UNREACHABLE = 'SOURCE_UNREACHABLE',\n /**\n * Access to the Google account was lost. The site owner needs to connect\n * again.\n */\n PERMISSION_REVOKED = 'PERMISSION_REVOKED',\n /** Google was still rate limiting after the queue used up its retries. */\n RATE_LIMIT_EXHAUSTED = 'RATE_LIMIT_EXHAUSTED',\n /**\n * The change may or may not have reached Google, and the queue chose not to\n * risk a duplicate by trying again. Additions only.\n *\n * Unlike every other reason here, this doesn't say anything is wrong with the\n * photo. It says the outcome couldn't be confirmed. Word it for the site owner\n * that way: \"we couldn't confirm this photo was added\", not \"this photo was\n * rejected\".\n */\n UPLOAD_UNVERIFIED = 'UPLOAD_UNVERIFIED',\n}\n\n/** @enumType */\nexport type MediaUploadFailureReasonWithLiterals =\n | MediaUploadFailureReason\n | 'IMAGE_TOO_SMALL'\n | 'ASPECT_RATIO_REJECTED'\n | 'FORMAT_UNSUPPORTED'\n | 'SOURCE_UNREACHABLE'\n | 'PERMISSION_REVOKED'\n | 'RATE_LIMIT_EXHAUSTED'\n | 'UPLOAD_UNVERIFIED';\n\nexport interface BulkCreateMediaUploadsRequest {\n /**\n * Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @minSize 1\n * @maxSize 52\n */\n mediaUploads: MediaUpload[];\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\nexport interface BulkCreateMediaUploadsResponse {\n /**\n * Results in the order the items were sent. An item that was already queued is\n * reported as a success carrying the existing item's `id`.\n * @minSize 1\n * @maxSize 52\n */\n results?: BulkCreateMediaUploadResult[];\n /** How many items succeeded and failed. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface ItemMetadata {\n /**\n * Item ID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.\n * @format GUID\n */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action for this item was successful. When `false`, the `error` field is returned. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkCreateMediaUploadResult {\n /** Whether this item was queued, and why not if it wasn't. */\n itemMetadata?: ItemMetadata;\n /** The queued item. Returned only when `returnEntity` is `true`. */\n item?: MediaUpload;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface ListMediaUploadsRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface ListMediaUploadsResponse {\n /**\n * Every outstanding change for the location, in the order it will be applied.\n * An empty list means the queue finished and nothing failed.\n *\n * Never paged and never truncated. If the set is somehow too large to return,\n * the call fails with `FAILED_PRECONDITION` rather than returning part of it.\n * @maxSize 500\n */\n mediaUploads?: MediaUpload[];\n}\n\nexport interface DismissMediaUploadFailuresRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface DismissMediaUploadFailuresResponse {\n /** How many failed changes were cleared. */\n dismissedCount?: number;\n}\n\n/** @docsIgnore */\nexport type BulkCreateMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_INVALID_SOURCE_URL';\n description?: string;\n data?: Record<string, any>;\n};\n/** @docsIgnore */\nexport type ListMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_LIST_TOO_LARGE';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param mediaUploads - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @public\n * @documentationMaturity preview\n * @requiredField mediaUploads\n * @permissionId gbp:location:v1:media_upload:bulk_create_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads\n */\nexport async function bulkCreateMediaUploads(\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n mediaUploads: mediaUploads,\n returnEntity: options?.returnEntity,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.bulkCreateMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n mediaUploads: '$[0]',\n returnEntity: '$[1].returnEntity',\n },\n singleArgumentUnchanged: false,\n },\n ['mediaUploads', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface BulkCreateMediaUploadsOptions {\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:list_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.ListMediaUploads\n */\nexport async function listMediaUploads(locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.listMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:dismiss_media_upload_failures\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures\n */\nexport async function dismissMediaUploadFailures(\n locationId: string\n): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.dismissMediaUploadFailures(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixGbpLocationV1MediaUploadServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/gbp/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_gbp_media-uploads';\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n */\nexport function bulkCreateMediaUploads(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkCreateMediaUploads({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/bulk/media-uploads/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateMediaUploads;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n */\nexport function listMediaUploads(payload: object): RequestOptionsFactory<any> {\n function __listMediaUploads({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'GET' as any,\n methodFqn: 'wix.gbp.location.v1.MediaUploadService.ListMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listMediaUploads;\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n */\nexport function dismissMediaUploadFailures(\n payload: object\n): RequestOptionsFactory<any> {\n function __dismissMediaUploadFailures({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads/dismiss-failures',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __dismissMediaUploadFailures;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n BulkCreateMediaUploadsApplicationErrors,\n BulkCreateMediaUploadsOptions,\n BulkCreateMediaUploadsResponse,\n DismissMediaUploadFailuresResponse,\n ListMediaUploadsApplicationErrors,\n ListMediaUploadsResponse,\n MediaUpload,\n bulkCreateMediaUploads as universalBulkCreateMediaUploads,\n dismissMediaUploadFailures as universalDismissMediaUploadFailures,\n listMediaUploads as universalListMediaUploads,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/gbp' };\n\nexport function bulkCreateMediaUploads(\n httpClient: HttpClient\n): BulkCreateMediaUploadsSignature {\n return (\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n ) =>\n universalBulkCreateMediaUploads(\n mediaUploads,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkCreateMediaUploadsSignature {\n /**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n */\n (\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n ): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n >;\n}\n\nexport function listMediaUploads(\n httpClient: HttpClient\n): ListMediaUploadsSignature {\n return (locationId: string) =>\n universalListMediaUploads(\n locationId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListMediaUploadsSignature {\n /**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param - ID of the location. This is Google's location identifier.\n */\n (locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n >;\n}\n\nexport function dismissMediaUploadFailures(\n httpClient: HttpClient\n): DismissMediaUploadFailuresSignature {\n return (locationId: string) =>\n universalDismissMediaUploadFailures(\n locationId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface DismissMediaUploadFailuresSignature {\n /**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param - ID of the location. This is Google's location identifier.\n */\n (locationId: string): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n >;\n}\n\nexport {\n ApplicationError,\n BulkActionMetadata,\n BulkCreateMediaUploadResult,\n BulkCreateMediaUploadsOptions,\n BulkCreateMediaUploadsRequest,\n BulkCreateMediaUploadsResponse,\n DismissMediaUploadFailuresRequest,\n DismissMediaUploadFailuresResponse,\n ItemMetadata,\n ListMediaUploadsRequest,\n ListMediaUploadsResponse,\n MediaCategory,\n MediaFormat,\n MediaUpload,\n MediaUploadFailure,\n MediaUploadFailureReason,\n MediaUploadOperation,\n MediaUploadState,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n","import {\n bulkCreateMediaUploads as publicBulkCreateMediaUploads,\n listMediaUploads as publicListMediaUploads,\n dismissMediaUploadFailures as publicDismissMediaUploadFailures,\n} from './gbp-location-v1-media-upload-media-uploads.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const bulkCreateMediaUploads: MaybeContext<\n BuildRESTFunction<typeof publicBulkCreateMediaUploads> &\n typeof publicBulkCreateMediaUploads\n> = /*#__PURE__*/ createRESTModule(publicBulkCreateMediaUploads);\nexport const listMediaUploads: MaybeContext<\n BuildRESTFunction<typeof publicListMediaUploads> &\n typeof publicListMediaUploads\n> = /*#__PURE__*/ createRESTModule(publicListMediaUploads);\nexport const dismissMediaUploadFailures: MaybeContext<\n BuildRESTFunction<typeof publicDismissMediaUploadFailures> &\n typeof publicDismissMediaUploadFailures\n> = /*#__PURE__*/ createRESTModule(publicDismissMediaUploadFailures);\n\nexport {\n MediaCategory,\n MediaFormat,\n MediaUploadOperation,\n MediaUploadState,\n MediaUploadFailureReason,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\nexport {\n MediaUpload,\n MediaUploadFailure,\n BulkCreateMediaUploadsRequest,\n BulkCreateMediaUploadsResponse,\n ItemMetadata,\n ApplicationError,\n BulkCreateMediaUploadResult,\n BulkActionMetadata,\n ListMediaUploadsRequest,\n ListMediaUploadsResponse,\n DismissMediaUploadFailuresRequest,\n DismissMediaUploadFailuresResponse,\n BulkCreateMediaUploadsOptions,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\nexport {\n MediaCategoryWithLiterals,\n MediaFormatWithLiterals,\n MediaUploadOperationWithLiterals,\n MediaUploadStateWithLiterals,\n MediaUploadFailureReasonWithLiterals,\n BulkCreateMediaUploadsApplicationErrors,\n ListMediaUploadsApplicationErrors,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,U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,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,YAAY,OAAO;AAAA,QAC/C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,YAAY;AAAA,IACf;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AExpBO,SAASC,wBACd,YACiC;AACjC,SAAO,CACL,cACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAwFO,SAASC,kBACd,YAC2B;AAC3B,SAAO,CAAC,eACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAoEO,SAASC,4BACd,YACqC;AACrC,SAAO,CAAC,eACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACtMA,SAAS,wBAAwB;AAG1B,IAAMC,0BAGK,iCAAiBA,uBAA4B;AACxD,IAAMC,oBAGK,iCAAiBA,iBAAsB;AAClD,IAAMC,8BAGK,iCAAiBA,2BAAgC;","names":["payload","MediaCategory","MediaFormat","MediaUploadOperation","MediaUploadState","MediaUploadFailureReason","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/gbp-location-v1-media-upload-media-uploads.universal.ts","../../../src/gbp-location-v1-media-upload-media-uploads.http.ts","../../../src/gbp-location-v1-media-upload-media-uploads.public.ts","../../../src/gbp-location-v1-media-upload-media-uploads.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGbpLocationV1MediaUpload from './gbp-location-v1-media-upload-media-uploads.http.js';\n\n/**\n * One queued photo change on a Google Business Profile location: either an\n * addition or a removal.\n *\n * Photo changes are queued and applied gradually rather than immediately,\n * because Google accepts only about 10 edits per minute per Business Profile.\n *\n * Anything you can read here is either still waiting to be applied or has\n * failed. A change that succeeded leaves nothing behind, so an empty list means\n * the queue finished and everything worked. See `state`.\n */\nexport interface MediaUpload {\n /**\n * Queued change ID.\n * @format GUID\n * @readonly\n */\n _id?: string;\n /**\n * ID of the location this change applies to. This is Google's location\n * identifier.\n * @immutable\n * @minLength 1\n * @maxLength 255\n */\n locationId?: string;\n /**\n * Groups the changes queued by one Bulk Create Media Uploads call. Useful for\n * troubleshooting, since one save can produce more than one batch.\n * @format GUID\n * @readonly\n */\n batchId?: string;\n /**\n * Your own key for this photo: `logo`, `cover`, or `photo:<id>`.\n *\n * Set it to something stable and meaningful to you. It's how a failure is\n * matched back to the photo that caused it, and it's part of what makes a\n * repeated submission a duplicate rather than a second change.\n * @maxLength 255\n */\n slotKey?: string;\n /**\n * Publicly reachable URL Google fetches the image from. Additions only.\n *\n * Keep it reachable well beyond the upload itself. A failure report renders\n * this URL as a thumbnail, possibly weeks later.\n * @maxLength 2048\n */\n sourceUrl?: string;\n /** Where the photo appears on the profile. Additions only. */\n category?: MediaCategoryWithLiterals;\n /** Media type of the photo. Additions only. */\n format?: MediaFormatWithLiterals;\n /** Whether this change adds a photo to the profile or removes one. */\n operation?: MediaUploadOperationWithLiterals;\n /**\n * Position in the order the queue applies changes, assigned by the server.\n *\n * Every removal comes before every addition, because Google rejects new photos\n * on a profile that's already at its limit, so the old ones have to go first.\n * Additions then follow as logo, cover, and gallery in the order given.\n * @readonly\n */\n sequence?: number;\n /**\n * Whether this change is waiting, being applied, or has failed.\n * @readonly\n */\n state?: MediaUploadStateWithLiterals;\n /**\n * How many times this change has been attempted.\n * @readonly\n */\n attempts?: number;\n /**\n * Google's identifier for the photo to remove. Removals only.\n * @maxLength 255\n */\n mediaKey?: string;\n /**\n * Why this change failed. Present only when `state` is `FAILED`.\n * @readonly\n */\n failure?: MediaUploadFailure;\n /**\n * Date and time the change was queued.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the change was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Revision number, incremented on every update.\n * @readonly\n */\n revision?: string;\n}\n\n/**\n * Where a media item is shown on the listing. Mirrors Google's mybusiness v4\n * LocationAssociation.Category.\n */\nexport enum MediaCategory {\n /** The banner image at the top of the profile. One per location. */\n COVER = 'COVER',\n /** The profile image shown alongside the business name. */\n PROFILE = 'PROFILE',\n /** The business's logo. One per location. */\n LOGO = 'LOGO',\n /** The outside of the premises, including the storefront. */\n EXTERIOR = 'EXTERIOR',\n /** The inside of the premises. */\n INTERIOR = 'INTERIOR',\n /** A product the business sells. */\n PRODUCT = 'PRODUCT',\n /** The team at work, such as staff serving customers. */\n AT_WORK = 'AT_WORK',\n /** Food or drink the business serves. */\n FOOD_AND_DRINK = 'FOOD_AND_DRINK',\n /** The menu, for a business that serves food or drink. */\n MENU = 'MENU',\n /** A shared space, such as a lobby or a waiting area. */\n COMMON_AREA = 'COMMON_AREA',\n /** Guest rooms, for accommodation businesses. */\n ROOMS = 'ROOMS',\n /** The people who work at the business. */\n TEAMS = 'TEAMS',\n /**\n * Anything that doesn't fit the other categories. This is the default for a\n * gallery photo.\n */\n ADDITIONAL = 'ADDITIONAL',\n}\n\n/** @enumType */\nexport type MediaCategoryWithLiterals =\n | MediaCategory\n | 'COVER'\n | 'PROFILE'\n | 'LOGO'\n | 'EXTERIOR'\n | 'INTERIOR'\n | 'PRODUCT'\n | 'AT_WORK'\n | 'FOOD_AND_DRINK'\n | 'MENU'\n | 'COMMON_AREA'\n | 'ROOMS'\n | 'TEAMS'\n | 'ADDITIONAL';\n\n/** Format of a media item. Mirrors Google's mybusiness v4 MediaFormat. */\nexport enum MediaFormat {\n PHOTO = 'PHOTO',\n VIDEO = 'VIDEO',\n}\n\n/** @enumType */\nexport type MediaFormatWithLiterals = MediaFormat | 'PHOTO' | 'VIDEO';\n\n/**\n * Whether a queued change adds a photo to the profile or removes one.\n *\n * Removals are edits too and draw on the same per-minute budget as additions,\n * which is why both go through the same queue.\n */\nexport enum MediaUploadOperation {\n /** Add a photo to the profile. */\n CREATE = 'CREATE',\n /** Remove a photo from the profile. */\n DELETE = 'DELETE',\n}\n\n/** @enumType */\nexport type MediaUploadOperationWithLiterals =\n | MediaUploadOperation\n | 'CREATE'\n | 'DELETE';\n\n/**\n * Where a queued photo change is in its lifecycle.\n *\n * There's no state for success. A change that succeeds is removed from the\n * queue, because Google's own media list is the record of what's live. So an\n * empty queue means everything worked, and failures stay until the next\n * submission for that location replaces them or you dismiss them.\n *\n * One consequence is worth knowing: because success leaves nothing behind, an\n * addition that succeeded and one that never ran look the same afterwards. When\n * the queue can't confirm an addition reached Google, it fails the change as\n * `UPLOAD_UNVERIFIED` instead of retrying it, so you don't end up with the same\n * photo twice. Removals carry no such risk and are retried freely.\n */\nexport enum MediaUploadState {\n /** Waiting its turn in the queue. */\n PENDING = 'PENDING',\n /**\n * Being applied to Google now. A change that stays here isn't one that never\n * ran: its outcome isn't known yet.\n */\n UPLOADING = 'UPLOADING',\n /** Failed, and won't be retried. Kept until replaced or dismissed. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type MediaUploadStateWithLiterals =\n | MediaUploadState\n | 'PENDING'\n | 'UPLOADING'\n | 'FAILED';\n\n/** Why a queued photo change failed. */\nexport interface MediaUploadFailure {\n /** Why the change failed, in terms you can show a site owner. */\n reason?: MediaUploadFailureReasonWithLiterals;\n /**\n * Internal, and withheld from public callers.\n *\n * Carries Google's own response text for the failure, which is support\n * diagnostics rather than developer contract. This service already withholds\n * exactly this on public read paths: LocationWithGoogle drops\n * google_response_body and google_error_message on the query path and records\n * them in the visibility events instead, because that path is reachable by\n * public apps. ListMediaUploads is now such a path, so the same rule applies\n * and `reason` is the whole public contract for a failure.\n * @internal\n * @maxLength 5000\n */\n errorMessage?: string;\n}\n\n/**\n * Why a photo change failed, in terms you can show a site owner.\n *\n * This is often the only account of the upload they'll ever see, and they may\n * read it long after the fact, so it's worth surfacing rather than logging.\n */\nexport enum MediaUploadFailureReason {\n /** Below Google's minimum dimensions. */\n IMAGE_TOO_SMALL = 'IMAGE_TOO_SMALL',\n /** Cover/logo ratio outside Google's accepted range. */\n ASPECT_RATIO_REJECTED = 'ASPECT_RATIO_REJECTED',\n /** File type Google will not accept. */\n FORMAT_UNSUPPORTED = 'FORMAT_UNSUPPORTED',\n /** Google could not fetch the image URL. */\n SOURCE_UNREACHABLE = 'SOURCE_UNREACHABLE',\n /**\n * Access to the Google account was lost. The site owner needs to connect\n * again.\n */\n PERMISSION_REVOKED = 'PERMISSION_REVOKED',\n /** Google was still rate limiting after the queue used up its retries. */\n RATE_LIMIT_EXHAUSTED = 'RATE_LIMIT_EXHAUSTED',\n /**\n * The change may or may not have reached Google, and the queue chose not to\n * risk a duplicate by trying again. Additions only.\n *\n * Unlike every other reason here, this doesn't say anything is wrong with the\n * photo. It says the outcome couldn't be confirmed. Word it for the site owner\n * that way: \"we couldn't confirm this photo was added\", not \"this photo was\n * rejected\".\n */\n UPLOAD_UNVERIFIED = 'UPLOAD_UNVERIFIED',\n}\n\n/** @enumType */\nexport type MediaUploadFailureReasonWithLiterals =\n | MediaUploadFailureReason\n | 'IMAGE_TOO_SMALL'\n | 'ASPECT_RATIO_REJECTED'\n | 'FORMAT_UNSUPPORTED'\n | 'SOURCE_UNREACHABLE'\n | 'PERMISSION_REVOKED'\n | 'RATE_LIMIT_EXHAUSTED'\n | 'UPLOAD_UNVERIFIED';\n\nexport interface BulkCreateMediaUploadsRequest {\n /**\n * Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @minSize 1\n * @maxSize 52\n */\n mediaUploads: MediaUpload[];\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\nexport interface BulkCreateMediaUploadsResponse {\n /**\n * Results in the order the items were sent. An item that was already queued is\n * reported as a success carrying the existing item's `id`.\n * @minSize 1\n * @maxSize 52\n */\n results?: BulkCreateMediaUploadResult[];\n /** How many items succeeded and failed. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface ItemMetadata {\n /**\n * Item ID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.\n * @format GUID\n */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action for this item was successful. When `false`, the `error` field is returned. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkCreateMediaUploadResult {\n /** Whether this item was queued, and why not if it wasn't. */\n itemMetadata?: ItemMetadata;\n /** The queued item. Returned only when `returnEntity` is `true`. */\n item?: MediaUpload;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface ListMediaUploadsRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface ListMediaUploadsResponse {\n /**\n * Every outstanding change for the location, in the order it will be applied.\n * An empty list means the queue finished and nothing failed.\n *\n * Never paged and never truncated. If the set is somehow too large to return,\n * the call fails with `FAILED_PRECONDITION` rather than returning part of it.\n * @maxSize 500\n */\n mediaUploads?: MediaUpload[];\n}\n\nexport interface DismissMediaUploadFailuresRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface DismissMediaUploadFailuresResponse {\n /** How many failed changes were cleared. */\n dismissedCount?: number;\n}\n\n/** @docsIgnore */\nexport type BulkCreateMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_INVALID_SOURCE_URL';\n description?: string;\n data?: Record<string, any>;\n};\n/** @docsIgnore */\nexport type ListMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_LIST_TOO_LARGE';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param mediaUploads - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @public\n * @documentationMaturity preview\n * @requiredField mediaUploads\n * @permissionId gbp:location:v1:media_upload:bulk_create_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads\n */\nexport async function bulkCreateMediaUploads(\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n mediaUploads: mediaUploads,\n returnEntity: options?.returnEntity,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.bulkCreateMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n mediaUploads: '$[0]',\n returnEntity: '$[1].returnEntity',\n },\n singleArgumentUnchanged: false,\n },\n ['mediaUploads', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface BulkCreateMediaUploadsOptions {\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:list_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.ListMediaUploads\n */\nexport async function listMediaUploads(locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.listMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:dismiss_media_upload_failures\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures\n */\nexport async function dismissMediaUploadFailures(\n locationId: string\n): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.dismissMediaUploadFailures(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixGbpLocationV1MediaUploadServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/gbp/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/v1/regions',\n destPath: '/v1/regions',\n },\n {\n srcPath: '/gbp/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/location/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/location/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/location/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/location/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/location/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/location/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n ],\n _: [\n {\n srcPath: '/gbp/location/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/location/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/location/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/location/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/location/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/location/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/location/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_gbp_media-uploads';\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n */\nexport function bulkCreateMediaUploads(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkCreateMediaUploads({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/bulk/media-uploads/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateMediaUploads;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n */\nexport function listMediaUploads(payload: object): RequestOptionsFactory<any> {\n function __listMediaUploads({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'GET' as any,\n methodFqn: 'wix.gbp.location.v1.MediaUploadService.ListMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listMediaUploads;\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n */\nexport function dismissMediaUploadFailures(\n payload: object\n): RequestOptionsFactory<any> {\n function __dismissMediaUploadFailures({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads/dismiss-failures',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __dismissMediaUploadFailures;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n BulkCreateMediaUploadsApplicationErrors,\n BulkCreateMediaUploadsOptions,\n BulkCreateMediaUploadsResponse,\n DismissMediaUploadFailuresResponse,\n ListMediaUploadsApplicationErrors,\n ListMediaUploadsResponse,\n MediaUpload,\n bulkCreateMediaUploads as universalBulkCreateMediaUploads,\n dismissMediaUploadFailures as universalDismissMediaUploadFailures,\n listMediaUploads as universalListMediaUploads,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/gbp' };\n\nexport function bulkCreateMediaUploads(\n httpClient: HttpClient\n): BulkCreateMediaUploadsSignature {\n return (\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n ) =>\n universalBulkCreateMediaUploads(\n mediaUploads,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkCreateMediaUploadsSignature {\n /**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n */\n (\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n ): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n >;\n}\n\nexport function listMediaUploads(\n httpClient: HttpClient\n): ListMediaUploadsSignature {\n return (locationId: string) =>\n universalListMediaUploads(\n locationId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListMediaUploadsSignature {\n /**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param - ID of the location. This is Google's location identifier.\n */\n (locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n >;\n}\n\nexport function dismissMediaUploadFailures(\n httpClient: HttpClient\n): DismissMediaUploadFailuresSignature {\n return (locationId: string) =>\n universalDismissMediaUploadFailures(\n locationId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface DismissMediaUploadFailuresSignature {\n /**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param - ID of the location. This is Google's location identifier.\n */\n (locationId: string): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n >;\n}\n\nexport {\n ApplicationError,\n BulkActionMetadata,\n BulkCreateMediaUploadResult,\n BulkCreateMediaUploadsOptions,\n BulkCreateMediaUploadsRequest,\n BulkCreateMediaUploadsResponse,\n DismissMediaUploadFailuresRequest,\n DismissMediaUploadFailuresResponse,\n ItemMetadata,\n ListMediaUploadsRequest,\n ListMediaUploadsResponse,\n MediaCategory,\n MediaFormat,\n MediaUpload,\n MediaUploadFailure,\n MediaUploadFailureReason,\n MediaUploadOperation,\n MediaUploadState,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n","import {\n bulkCreateMediaUploads as publicBulkCreateMediaUploads,\n listMediaUploads as publicListMediaUploads,\n dismissMediaUploadFailures as publicDismissMediaUploadFailures,\n} from './gbp-location-v1-media-upload-media-uploads.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const bulkCreateMediaUploads: MaybeContext<\n BuildRESTFunction<typeof publicBulkCreateMediaUploads> &\n typeof publicBulkCreateMediaUploads\n> = /*#__PURE__*/ createRESTModule(publicBulkCreateMediaUploads);\nexport const listMediaUploads: MaybeContext<\n BuildRESTFunction<typeof publicListMediaUploads> &\n typeof publicListMediaUploads\n> = /*#__PURE__*/ createRESTModule(publicListMediaUploads);\nexport const dismissMediaUploadFailures: MaybeContext<\n BuildRESTFunction<typeof publicDismissMediaUploadFailures> &\n typeof publicDismissMediaUploadFailures\n> = /*#__PURE__*/ createRESTModule(publicDismissMediaUploadFailures);\n\nexport {\n MediaCategory,\n MediaFormat,\n MediaUploadOperation,\n MediaUploadState,\n MediaUploadFailureReason,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\nexport {\n MediaUpload,\n MediaUploadFailure,\n BulkCreateMediaUploadsRequest,\n BulkCreateMediaUploadsResponse,\n ItemMetadata,\n ApplicationError,\n BulkCreateMediaUploadResult,\n BulkActionMetadata,\n ListMediaUploadsRequest,\n ListMediaUploadsResponse,\n DismissMediaUploadFailuresRequest,\n DismissMediaUploadFailuresResponse,\n BulkCreateMediaUploadsOptions,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\nexport {\n MediaCategoryWithLiterals,\n MediaFormatWithLiterals,\n MediaUploadOperationWithLiterals,\n MediaUploadStateWithLiterals,\n MediaUploadFailureReasonWithLiterals,\n BulkCreateMediaUploadsApplicationErrors,\n ListMediaUploadsApplicationErrors,\n} from './gbp-location-v1-media-upload-media-uploads.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AA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AW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,YAAY,OAAO;AAAA,QAC/C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,YAAY;AAAA,IACf;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AExqBO,SAASC,wBACd,YACiC;AACjC,SAAO,CACL,cACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAwFO,SAASC,kBACd,YAC2B;AAC3B,SAAO,CAAC,eACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAoEO,SAASC,4BACd,YACqC;AACrC,SAAO,CAAC,eACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACtMA,SAAS,wBAAwB;AAG1B,IAAMC,0BAGK,iCAAiBA,uBAA4B;AACxD,IAAMC,oBAGK,iCAAiBA,iBAAsB;AAClD,IAAMC,8BAGK,iCAAiBA,2BAAgC;","names":["payload","MediaCategory","MediaFormat","MediaUploadOperation","MediaUploadState","MediaUploadFailureReason","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures"]}
|
|
@@ -106,18 +106,34 @@ interface MediaUpload {
|
|
|
106
106
|
* LocationAssociation.Category.
|
|
107
107
|
*/
|
|
108
108
|
declare enum MediaCategory {
|
|
109
|
+
/** The banner image at the top of the profile. One per location. */
|
|
109
110
|
COVER = "COVER",
|
|
111
|
+
/** The profile image shown alongside the business name. */
|
|
110
112
|
PROFILE = "PROFILE",
|
|
113
|
+
/** The business's logo. One per location. */
|
|
111
114
|
LOGO = "LOGO",
|
|
115
|
+
/** The outside of the premises, including the storefront. */
|
|
112
116
|
EXTERIOR = "EXTERIOR",
|
|
117
|
+
/** The inside of the premises. */
|
|
113
118
|
INTERIOR = "INTERIOR",
|
|
119
|
+
/** A product the business sells. */
|
|
114
120
|
PRODUCT = "PRODUCT",
|
|
121
|
+
/** The team at work, such as staff serving customers. */
|
|
115
122
|
AT_WORK = "AT_WORK",
|
|
123
|
+
/** Food or drink the business serves. */
|
|
116
124
|
FOOD_AND_DRINK = "FOOD_AND_DRINK",
|
|
125
|
+
/** The menu, for a business that serves food or drink. */
|
|
117
126
|
MENU = "MENU",
|
|
127
|
+
/** A shared space, such as a lobby or a waiting area. */
|
|
118
128
|
COMMON_AREA = "COMMON_AREA",
|
|
129
|
+
/** Guest rooms, for accommodation businesses. */
|
|
119
130
|
ROOMS = "ROOMS",
|
|
131
|
+
/** The people who work at the business. */
|
|
120
132
|
TEAMS = "TEAMS",
|
|
133
|
+
/**
|
|
134
|
+
* Anything that doesn't fit the other categories. This is the default for a
|
|
135
|
+
* gallery photo.
|
|
136
|
+
*/
|
|
121
137
|
ADDITIONAL = "ADDITIONAL"
|
|
122
138
|
}
|
|
123
139
|
/** @enumType */
|
|
@@ -69,6 +69,90 @@ function resolveWixGbpLocationV1MediaUploadServiceUrl(opts) {
|
|
|
69
69
|
{
|
|
70
70
|
srcPath: "/gbp/v1/regions",
|
|
71
71
|
destPath: "/v1/regions"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
srcPath: "/gbp/v1/categories",
|
|
75
|
+
destPath: "/v1/categories"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
srcPath: "/gbp/location/v1/categories",
|
|
79
|
+
destPath: "/v1/categories"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
srcPath: "/gbp/location/v1/accounts",
|
|
83
|
+
destPath: "/v1/accounts"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
srcPath: "/gbp/location/v1/address-schema",
|
|
87
|
+
destPath: "/v1/address-schema"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
srcPath: "/gbp/location/v1/attribute-metadata",
|
|
91
|
+
destPath: "/v1/attribute-metadata"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
srcPath: "/gbp/location/v1/bulk",
|
|
95
|
+
destPath: "/v1/bulk"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
srcPath: "/gbp/location/v1/establishments",
|
|
99
|
+
destPath: "/v1/establishments"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
srcPath: "/gbp/location/v1/google-locations",
|
|
103
|
+
destPath: "/v1/google-locations"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
srcPath: "/gbp/location/v1/locations",
|
|
107
|
+
destPath: "/v1/locations"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
srcPath: "/gbp/location/v1/regions",
|
|
111
|
+
destPath: "/v1/regions"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"www._base_domain_": [
|
|
115
|
+
{
|
|
116
|
+
srcPath: "/gbp/location/v1/locations",
|
|
117
|
+
destPath: "/v1/locations"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
_: [
|
|
121
|
+
{
|
|
122
|
+
srcPath: "/gbp/location/v1/accounts",
|
|
123
|
+
destPath: "/v1/accounts"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
srcPath: "/gbp/location/v1/address-schema",
|
|
127
|
+
destPath: "/v1/address-schema"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
srcPath: "/gbp/location/v1/attribute-metadata",
|
|
131
|
+
destPath: "/v1/attribute-metadata"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
srcPath: "/gbp/location/v1/bulk",
|
|
135
|
+
destPath: "/v1/bulk"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
srcPath: "/gbp/location/v1/categories",
|
|
139
|
+
destPath: "/v1/categories"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
srcPath: "/gbp/location/v1/establishments",
|
|
143
|
+
destPath: "/v1/establishments"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
srcPath: "/gbp/location/v1/google-locations",
|
|
147
|
+
destPath: "/v1/google-locations"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
srcPath: "/gbp/location/v1/locations",
|
|
151
|
+
destPath: "/v1/locations"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
srcPath: "/gbp/location/v1/regions",
|
|
155
|
+
destPath: "/v1/regions"
|
|
72
156
|
}
|
|
73
157
|
]
|
|
74
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/gbp-location-v1-media-upload-media-uploads.universal.ts","../../../src/gbp-location-v1-media-upload-media-uploads.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGbpLocationV1MediaUpload from './gbp-location-v1-media-upload-media-uploads.http.js';\n\n/**\n * One queued photo change on a Google Business Profile location: either an\n * addition or a removal.\n *\n * Photo changes are queued and applied gradually rather than immediately,\n * because Google accepts only about 10 edits per minute per Business Profile.\n *\n * Anything you can read here is either still waiting to be applied or has\n * failed. A change that succeeded leaves nothing behind, so an empty list means\n * the queue finished and everything worked. See `state`.\n */\nexport interface MediaUpload {\n /**\n * Queued change ID.\n * @format GUID\n * @readonly\n */\n _id?: string;\n /**\n * ID of the location this change applies to. This is Google's location\n * identifier.\n * @immutable\n * @minLength 1\n * @maxLength 255\n */\n locationId?: string;\n /**\n * Groups the changes queued by one Bulk Create Media Uploads call. Useful for\n * troubleshooting, since one save can produce more than one batch.\n * @format GUID\n * @readonly\n */\n batchId?: string;\n /**\n * Your own key for this photo: `logo`, `cover`, or `photo:<id>`.\n *\n * Set it to something stable and meaningful to you. It's how a failure is\n * matched back to the photo that caused it, and it's part of what makes a\n * repeated submission a duplicate rather than a second change.\n * @maxLength 255\n */\n slotKey?: string;\n /**\n * Publicly reachable URL Google fetches the image from. Additions only.\n *\n * Keep it reachable well beyond the upload itself. A failure report renders\n * this URL as a thumbnail, possibly weeks later.\n * @maxLength 2048\n */\n sourceUrl?: string;\n /** Where the photo appears on the profile. Additions only. */\n category?: MediaCategoryWithLiterals;\n /** Media type of the photo. Additions only. */\n format?: MediaFormatWithLiterals;\n /** Whether this change adds a photo to the profile or removes one. */\n operation?: MediaUploadOperationWithLiterals;\n /**\n * Position in the order the queue applies changes, assigned by the server.\n *\n * Every removal comes before every addition, because Google rejects new photos\n * on a profile that's already at its limit, so the old ones have to go first.\n * Additions then follow as logo, cover, and gallery in the order given.\n * @readonly\n */\n sequence?: number;\n /**\n * Whether this change is waiting, being applied, or has failed.\n * @readonly\n */\n state?: MediaUploadStateWithLiterals;\n /**\n * How many times this change has been attempted.\n * @readonly\n */\n attempts?: number;\n /**\n * Google's identifier for the photo to remove. Removals only.\n * @maxLength 255\n */\n mediaKey?: string;\n /**\n * Why this change failed. Present only when `state` is `FAILED`.\n * @readonly\n */\n failure?: MediaUploadFailure;\n /**\n * Date and time the change was queued.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the change was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Revision number, incremented on every update.\n * @readonly\n */\n revision?: string;\n}\n\n/**\n * Where a media item is shown on the listing. Mirrors Google's mybusiness v4\n * LocationAssociation.Category.\n */\nexport enum MediaCategory {\n COVER = 'COVER',\n PROFILE = 'PROFILE',\n LOGO = 'LOGO',\n EXTERIOR = 'EXTERIOR',\n INTERIOR = 'INTERIOR',\n PRODUCT = 'PRODUCT',\n AT_WORK = 'AT_WORK',\n FOOD_AND_DRINK = 'FOOD_AND_DRINK',\n MENU = 'MENU',\n COMMON_AREA = 'COMMON_AREA',\n ROOMS = 'ROOMS',\n TEAMS = 'TEAMS',\n ADDITIONAL = 'ADDITIONAL',\n}\n\n/** @enumType */\nexport type MediaCategoryWithLiterals =\n | MediaCategory\n | 'COVER'\n | 'PROFILE'\n | 'LOGO'\n | 'EXTERIOR'\n | 'INTERIOR'\n | 'PRODUCT'\n | 'AT_WORK'\n | 'FOOD_AND_DRINK'\n | 'MENU'\n | 'COMMON_AREA'\n | 'ROOMS'\n | 'TEAMS'\n | 'ADDITIONAL';\n\n/** Format of a media item. Mirrors Google's mybusiness v4 MediaFormat. */\nexport enum MediaFormat {\n PHOTO = 'PHOTO',\n VIDEO = 'VIDEO',\n}\n\n/** @enumType */\nexport type MediaFormatWithLiterals = MediaFormat | 'PHOTO' | 'VIDEO';\n\n/**\n * Whether a queued change adds a photo to the profile or removes one.\n *\n * Removals are edits too and draw on the same per-minute budget as additions,\n * which is why both go through the same queue.\n */\nexport enum MediaUploadOperation {\n /** Add a photo to the profile. */\n CREATE = 'CREATE',\n /** Remove a photo from the profile. */\n DELETE = 'DELETE',\n}\n\n/** @enumType */\nexport type MediaUploadOperationWithLiterals =\n | MediaUploadOperation\n | 'CREATE'\n | 'DELETE';\n\n/**\n * Where a queued photo change is in its lifecycle.\n *\n * There's no state for success. A change that succeeds is removed from the\n * queue, because Google's own media list is the record of what's live. So an\n * empty queue means everything worked, and failures stay until the next\n * submission for that location replaces them or you dismiss them.\n *\n * One consequence is worth knowing: because success leaves nothing behind, an\n * addition that succeeded and one that never ran look the same afterwards. When\n * the queue can't confirm an addition reached Google, it fails the change as\n * `UPLOAD_UNVERIFIED` instead of retrying it, so you don't end up with the same\n * photo twice. Removals carry no such risk and are retried freely.\n */\nexport enum MediaUploadState {\n /** Waiting its turn in the queue. */\n PENDING = 'PENDING',\n /**\n * Being applied to Google now. A change that stays here isn't one that never\n * ran: its outcome isn't known yet.\n */\n UPLOADING = 'UPLOADING',\n /** Failed, and won't be retried. Kept until replaced or dismissed. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type MediaUploadStateWithLiterals =\n | MediaUploadState\n | 'PENDING'\n | 'UPLOADING'\n | 'FAILED';\n\n/** Why a queued photo change failed. */\nexport interface MediaUploadFailure {\n /** Why the change failed, in terms you can show a site owner. */\n reason?: MediaUploadFailureReasonWithLiterals;\n /**\n * Internal, and withheld from public callers.\n *\n * Carries Google's own response text for the failure, which is support\n * diagnostics rather than developer contract. This service already withholds\n * exactly this on public read paths: LocationWithGoogle drops\n * google_response_body and google_error_message on the query path and records\n * them in the visibility events instead, because that path is reachable by\n * public apps. ListMediaUploads is now such a path, so the same rule applies\n * and `reason` is the whole public contract for a failure.\n * @internal\n * @maxLength 5000\n */\n errorMessage?: string;\n}\n\n/**\n * Why a photo change failed, in terms you can show a site owner.\n *\n * This is often the only account of the upload they'll ever see, and they may\n * read it long after the fact, so it's worth surfacing rather than logging.\n */\nexport enum MediaUploadFailureReason {\n /** Below Google's minimum dimensions. */\n IMAGE_TOO_SMALL = 'IMAGE_TOO_SMALL',\n /** Cover/logo ratio outside Google's accepted range. */\n ASPECT_RATIO_REJECTED = 'ASPECT_RATIO_REJECTED',\n /** File type Google will not accept. */\n FORMAT_UNSUPPORTED = 'FORMAT_UNSUPPORTED',\n /** Google could not fetch the image URL. */\n SOURCE_UNREACHABLE = 'SOURCE_UNREACHABLE',\n /**\n * Access to the Google account was lost. The site owner needs to connect\n * again.\n */\n PERMISSION_REVOKED = 'PERMISSION_REVOKED',\n /** Google was still rate limiting after the queue used up its retries. */\n RATE_LIMIT_EXHAUSTED = 'RATE_LIMIT_EXHAUSTED',\n /**\n * The change may or may not have reached Google, and the queue chose not to\n * risk a duplicate by trying again. Additions only.\n *\n * Unlike every other reason here, this doesn't say anything is wrong with the\n * photo. It says the outcome couldn't be confirmed. Word it for the site owner\n * that way: \"we couldn't confirm this photo was added\", not \"this photo was\n * rejected\".\n */\n UPLOAD_UNVERIFIED = 'UPLOAD_UNVERIFIED',\n}\n\n/** @enumType */\nexport type MediaUploadFailureReasonWithLiterals =\n | MediaUploadFailureReason\n | 'IMAGE_TOO_SMALL'\n | 'ASPECT_RATIO_REJECTED'\n | 'FORMAT_UNSUPPORTED'\n | 'SOURCE_UNREACHABLE'\n | 'PERMISSION_REVOKED'\n | 'RATE_LIMIT_EXHAUSTED'\n | 'UPLOAD_UNVERIFIED';\n\nexport interface BulkCreateMediaUploadsRequest {\n /**\n * Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @minSize 1\n * @maxSize 52\n */\n mediaUploads: MediaUpload[];\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\nexport interface BulkCreateMediaUploadsResponse {\n /**\n * Results in the order the items were sent. An item that was already queued is\n * reported as a success carrying the existing item's `id`.\n * @minSize 1\n * @maxSize 52\n */\n results?: BulkCreateMediaUploadResult[];\n /** How many items succeeded and failed. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface ItemMetadata {\n /**\n * Item ID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.\n * @format GUID\n */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action for this item was successful. When `false`, the `error` field is returned. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkCreateMediaUploadResult {\n /** Whether this item was queued, and why not if it wasn't. */\n itemMetadata?: ItemMetadata;\n /** The queued item. Returned only when `returnEntity` is `true`. */\n item?: MediaUpload;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface ListMediaUploadsRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface ListMediaUploadsResponse {\n /**\n * Every outstanding change for the location, in the order it will be applied.\n * An empty list means the queue finished and nothing failed.\n *\n * Never paged and never truncated. If the set is somehow too large to return,\n * the call fails with `FAILED_PRECONDITION` rather than returning part of it.\n * @maxSize 500\n */\n mediaUploads?: MediaUpload[];\n}\n\nexport interface DismissMediaUploadFailuresRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface DismissMediaUploadFailuresResponse {\n /** How many failed changes were cleared. */\n dismissedCount?: number;\n}\n\n/** @docsIgnore */\nexport type BulkCreateMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_INVALID_SOURCE_URL';\n description?: string;\n data?: Record<string, any>;\n};\n/** @docsIgnore */\nexport type ListMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_LIST_TOO_LARGE';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param mediaUploads - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @public\n * @documentationMaturity preview\n * @requiredField mediaUploads\n * @permissionId gbp:location:v1:media_upload:bulk_create_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads\n */\nexport async function bulkCreateMediaUploads(\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n mediaUploads: mediaUploads,\n returnEntity: options?.returnEntity,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.bulkCreateMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n mediaUploads: '$[0]',\n returnEntity: '$[1].returnEntity',\n },\n singleArgumentUnchanged: false,\n },\n ['mediaUploads', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface BulkCreateMediaUploadsOptions {\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:list_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.ListMediaUploads\n */\nexport async function listMediaUploads(locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.listMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:dismiss_media_upload_failures\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures\n */\nexport async function dismissMediaUploadFailures(\n locationId: string\n): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.dismissMediaUploadFailures(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixGbpLocationV1MediaUploadServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/gbp/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_gbp_media-uploads';\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n */\nexport function bulkCreateMediaUploads(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkCreateMediaUploads({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/bulk/media-uploads/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateMediaUploads;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n */\nexport function listMediaUploads(payload: object): RequestOptionsFactory<any> {\n function __listMediaUploads({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'GET' as any,\n methodFqn: 'wix.gbp.location.v1.MediaUploadService.ListMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listMediaUploads;\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n */\nexport function dismissMediaUploadFailures(\n payload: object\n): RequestOptionsFactory<any> {\n function __dismissMediaUploadFailures({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads/dismiss-failures',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __dismissMediaUploadFailures;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAA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AAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,YAAY,OAAO;AAAA,QAC/C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,YAAY;AAAA,IACf;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","MediaCategory","MediaFormat","MediaUploadOperation","MediaUploadState","MediaUploadFailureReason","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/gbp-location-v1-media-upload-media-uploads.universal.ts","../../../src/gbp-location-v1-media-upload-media-uploads.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGbpLocationV1MediaUpload from './gbp-location-v1-media-upload-media-uploads.http.js';\n\n/**\n * One queued photo change on a Google Business Profile location: either an\n * addition or a removal.\n *\n * Photo changes are queued and applied gradually rather than immediately,\n * because Google accepts only about 10 edits per minute per Business Profile.\n *\n * Anything you can read here is either still waiting to be applied or has\n * failed. A change that succeeded leaves nothing behind, so an empty list means\n * the queue finished and everything worked. See `state`.\n */\nexport interface MediaUpload {\n /**\n * Queued change ID.\n * @format GUID\n * @readonly\n */\n _id?: string;\n /**\n * ID of the location this change applies to. This is Google's location\n * identifier.\n * @immutable\n * @minLength 1\n * @maxLength 255\n */\n locationId?: string;\n /**\n * Groups the changes queued by one Bulk Create Media Uploads call. Useful for\n * troubleshooting, since one save can produce more than one batch.\n * @format GUID\n * @readonly\n */\n batchId?: string;\n /**\n * Your own key for this photo: `logo`, `cover`, or `photo:<id>`.\n *\n * Set it to something stable and meaningful to you. It's how a failure is\n * matched back to the photo that caused it, and it's part of what makes a\n * repeated submission a duplicate rather than a second change.\n * @maxLength 255\n */\n slotKey?: string;\n /**\n * Publicly reachable URL Google fetches the image from. Additions only.\n *\n * Keep it reachable well beyond the upload itself. A failure report renders\n * this URL as a thumbnail, possibly weeks later.\n * @maxLength 2048\n */\n sourceUrl?: string;\n /** Where the photo appears on the profile. Additions only. */\n category?: MediaCategoryWithLiterals;\n /** Media type of the photo. Additions only. */\n format?: MediaFormatWithLiterals;\n /** Whether this change adds a photo to the profile or removes one. */\n operation?: MediaUploadOperationWithLiterals;\n /**\n * Position in the order the queue applies changes, assigned by the server.\n *\n * Every removal comes before every addition, because Google rejects new photos\n * on a profile that's already at its limit, so the old ones have to go first.\n * Additions then follow as logo, cover, and gallery in the order given.\n * @readonly\n */\n sequence?: number;\n /**\n * Whether this change is waiting, being applied, or has failed.\n * @readonly\n */\n state?: MediaUploadStateWithLiterals;\n /**\n * How many times this change has been attempted.\n * @readonly\n */\n attempts?: number;\n /**\n * Google's identifier for the photo to remove. Removals only.\n * @maxLength 255\n */\n mediaKey?: string;\n /**\n * Why this change failed. Present only when `state` is `FAILED`.\n * @readonly\n */\n failure?: MediaUploadFailure;\n /**\n * Date and time the change was queued.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the change was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /**\n * Revision number, incremented on every update.\n * @readonly\n */\n revision?: string;\n}\n\n/**\n * Where a media item is shown on the listing. Mirrors Google's mybusiness v4\n * LocationAssociation.Category.\n */\nexport enum MediaCategory {\n /** The banner image at the top of the profile. One per location. */\n COVER = 'COVER',\n /** The profile image shown alongside the business name. */\n PROFILE = 'PROFILE',\n /** The business's logo. One per location. */\n LOGO = 'LOGO',\n /** The outside of the premises, including the storefront. */\n EXTERIOR = 'EXTERIOR',\n /** The inside of the premises. */\n INTERIOR = 'INTERIOR',\n /** A product the business sells. */\n PRODUCT = 'PRODUCT',\n /** The team at work, such as staff serving customers. */\n AT_WORK = 'AT_WORK',\n /** Food or drink the business serves. */\n FOOD_AND_DRINK = 'FOOD_AND_DRINK',\n /** The menu, for a business that serves food or drink. */\n MENU = 'MENU',\n /** A shared space, such as a lobby or a waiting area. */\n COMMON_AREA = 'COMMON_AREA',\n /** Guest rooms, for accommodation businesses. */\n ROOMS = 'ROOMS',\n /** The people who work at the business. */\n TEAMS = 'TEAMS',\n /**\n * Anything that doesn't fit the other categories. This is the default for a\n * gallery photo.\n */\n ADDITIONAL = 'ADDITIONAL',\n}\n\n/** @enumType */\nexport type MediaCategoryWithLiterals =\n | MediaCategory\n | 'COVER'\n | 'PROFILE'\n | 'LOGO'\n | 'EXTERIOR'\n | 'INTERIOR'\n | 'PRODUCT'\n | 'AT_WORK'\n | 'FOOD_AND_DRINK'\n | 'MENU'\n | 'COMMON_AREA'\n | 'ROOMS'\n | 'TEAMS'\n | 'ADDITIONAL';\n\n/** Format of a media item. Mirrors Google's mybusiness v4 MediaFormat. */\nexport enum MediaFormat {\n PHOTO = 'PHOTO',\n VIDEO = 'VIDEO',\n}\n\n/** @enumType */\nexport type MediaFormatWithLiterals = MediaFormat | 'PHOTO' | 'VIDEO';\n\n/**\n * Whether a queued change adds a photo to the profile or removes one.\n *\n * Removals are edits too and draw on the same per-minute budget as additions,\n * which is why both go through the same queue.\n */\nexport enum MediaUploadOperation {\n /** Add a photo to the profile. */\n CREATE = 'CREATE',\n /** Remove a photo from the profile. */\n DELETE = 'DELETE',\n}\n\n/** @enumType */\nexport type MediaUploadOperationWithLiterals =\n | MediaUploadOperation\n | 'CREATE'\n | 'DELETE';\n\n/**\n * Where a queued photo change is in its lifecycle.\n *\n * There's no state for success. A change that succeeds is removed from the\n * queue, because Google's own media list is the record of what's live. So an\n * empty queue means everything worked, and failures stay until the next\n * submission for that location replaces them or you dismiss them.\n *\n * One consequence is worth knowing: because success leaves nothing behind, an\n * addition that succeeded and one that never ran look the same afterwards. When\n * the queue can't confirm an addition reached Google, it fails the change as\n * `UPLOAD_UNVERIFIED` instead of retrying it, so you don't end up with the same\n * photo twice. Removals carry no such risk and are retried freely.\n */\nexport enum MediaUploadState {\n /** Waiting its turn in the queue. */\n PENDING = 'PENDING',\n /**\n * Being applied to Google now. A change that stays here isn't one that never\n * ran: its outcome isn't known yet.\n */\n UPLOADING = 'UPLOADING',\n /** Failed, and won't be retried. Kept until replaced or dismissed. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type MediaUploadStateWithLiterals =\n | MediaUploadState\n | 'PENDING'\n | 'UPLOADING'\n | 'FAILED';\n\n/** Why a queued photo change failed. */\nexport interface MediaUploadFailure {\n /** Why the change failed, in terms you can show a site owner. */\n reason?: MediaUploadFailureReasonWithLiterals;\n /**\n * Internal, and withheld from public callers.\n *\n * Carries Google's own response text for the failure, which is support\n * diagnostics rather than developer contract. This service already withholds\n * exactly this on public read paths: LocationWithGoogle drops\n * google_response_body and google_error_message on the query path and records\n * them in the visibility events instead, because that path is reachable by\n * public apps. ListMediaUploads is now such a path, so the same rule applies\n * and `reason` is the whole public contract for a failure.\n * @internal\n * @maxLength 5000\n */\n errorMessage?: string;\n}\n\n/**\n * Why a photo change failed, in terms you can show a site owner.\n *\n * This is often the only account of the upload they'll ever see, and they may\n * read it long after the fact, so it's worth surfacing rather than logging.\n */\nexport enum MediaUploadFailureReason {\n /** Below Google's minimum dimensions. */\n IMAGE_TOO_SMALL = 'IMAGE_TOO_SMALL',\n /** Cover/logo ratio outside Google's accepted range. */\n ASPECT_RATIO_REJECTED = 'ASPECT_RATIO_REJECTED',\n /** File type Google will not accept. */\n FORMAT_UNSUPPORTED = 'FORMAT_UNSUPPORTED',\n /** Google could not fetch the image URL. */\n SOURCE_UNREACHABLE = 'SOURCE_UNREACHABLE',\n /**\n * Access to the Google account was lost. The site owner needs to connect\n * again.\n */\n PERMISSION_REVOKED = 'PERMISSION_REVOKED',\n /** Google was still rate limiting after the queue used up its retries. */\n RATE_LIMIT_EXHAUSTED = 'RATE_LIMIT_EXHAUSTED',\n /**\n * The change may or may not have reached Google, and the queue chose not to\n * risk a duplicate by trying again. Additions only.\n *\n * Unlike every other reason here, this doesn't say anything is wrong with the\n * photo. It says the outcome couldn't be confirmed. Word it for the site owner\n * that way: \"we couldn't confirm this photo was added\", not \"this photo was\n * rejected\".\n */\n UPLOAD_UNVERIFIED = 'UPLOAD_UNVERIFIED',\n}\n\n/** @enumType */\nexport type MediaUploadFailureReasonWithLiterals =\n | MediaUploadFailureReason\n | 'IMAGE_TOO_SMALL'\n | 'ASPECT_RATIO_REJECTED'\n | 'FORMAT_UNSUPPORTED'\n | 'SOURCE_UNREACHABLE'\n | 'PERMISSION_REVOKED'\n | 'RATE_LIMIT_EXHAUSTED'\n | 'UPLOAD_UNVERIFIED';\n\nexport interface BulkCreateMediaUploadsRequest {\n /**\n * Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @minSize 1\n * @maxSize 52\n */\n mediaUploads: MediaUpload[];\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\nexport interface BulkCreateMediaUploadsResponse {\n /**\n * Results in the order the items were sent. An item that was already queued is\n * reported as a success carrying the existing item's `id`.\n * @minSize 1\n * @maxSize 52\n */\n results?: BulkCreateMediaUploadResult[];\n /** How many items succeeded and failed. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface ItemMetadata {\n /**\n * Item ID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.\n * @format GUID\n */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action for this item was successful. When `false`, the `error` field is returned. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkCreateMediaUploadResult {\n /** Whether this item was queued, and why not if it wasn't. */\n itemMetadata?: ItemMetadata;\n /** The queued item. Returned only when `returnEntity` is `true`. */\n item?: MediaUpload;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface ListMediaUploadsRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface ListMediaUploadsResponse {\n /**\n * Every outstanding change for the location, in the order it will be applied.\n * An empty list means the queue finished and nothing failed.\n *\n * Never paged and never truncated. If the set is somehow too large to return,\n * the call fails with `FAILED_PRECONDITION` rather than returning part of it.\n * @maxSize 500\n */\n mediaUploads?: MediaUpload[];\n}\n\nexport interface DismissMediaUploadFailuresRequest {\n /**\n * ID of the location. This is Google's location identifier.\n * @minLength 1\n * @maxLength 255\n */\n locationId: string;\n}\n\nexport interface DismissMediaUploadFailuresResponse {\n /** How many failed changes were cleared. */\n dismissedCount?: number;\n}\n\n/** @docsIgnore */\nexport type BulkCreateMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_INVALID_SOURCE_URL';\n description?: string;\n data?: Record<string, any>;\n};\n/** @docsIgnore */\nexport type ListMediaUploadsApplicationErrors = {\n code?: 'MEDIA_UPLOAD_LIST_TOO_LARGE';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n * @param mediaUploads - Photo changes to queue. All must share one `locationId` and one `operation`.\n *\n * Per item set `locationId`, `operation`, `slotKey`, and then either\n * `sourceUrl`, `category` and `format` to add, or `mediaKey` to remove. Every\n * other field is assigned by the server and ignored if you send it.\n *\n * Up to 52 items: 50 gallery photos plus a logo and a cover.\n * @public\n * @documentationMaturity preview\n * @requiredField mediaUploads\n * @permissionId gbp:location:v1:media_upload:bulk_create_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads\n */\nexport async function bulkCreateMediaUploads(\n mediaUploads: MediaUpload[],\n options?: BulkCreateMediaUploadsOptions\n): Promise<\n NonNullablePaths<\n BulkCreateMediaUploadsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item._id`\n | `results.${number}.item.locationId`\n | `results.${number}.item.batchId`\n | `results.${number}.item.slotKey`\n | `results.${number}.item.sourceUrl`\n | `results.${number}.item.category`\n | `results.${number}.item.format`\n | `results.${number}.item.operation`\n | `results.${number}.item.sequence`\n | `results.${number}.item.state`\n | `results.${number}.item.attempts`\n | `results.${number}.item.mediaKey`\n | `results.${number}.item.failure.reason`\n | `results.${number}.item.revision`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`,\n 6\n > & {\n __applicationErrorsType?: BulkCreateMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n mediaUploads: mediaUploads,\n returnEntity: options?.returnEntity,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.bulkCreateMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n mediaUploads: '$[0]',\n returnEntity: '$[1].returnEntity',\n },\n singleArgumentUnchanged: false,\n },\n ['mediaUploads', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface BulkCreateMediaUploadsOptions {\n /** Whether to return each queued item in `results.item`. */\n returnEntity?: boolean;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:list_media_uploads\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.ListMediaUploads\n */\nexport async function listMediaUploads(locationId: string): Promise<\n NonNullablePaths<\n ListMediaUploadsResponse,\n | `mediaUploads`\n | `mediaUploads.${number}._id`\n | `mediaUploads.${number}.locationId`\n | `mediaUploads.${number}.batchId`\n | `mediaUploads.${number}.slotKey`\n | `mediaUploads.${number}.sourceUrl`\n | `mediaUploads.${number}.category`\n | `mediaUploads.${number}.format`\n | `mediaUploads.${number}.operation`\n | `mediaUploads.${number}.sequence`\n | `mediaUploads.${number}.state`\n | `mediaUploads.${number}.attempts`\n | `mediaUploads.${number}.mediaKey`\n | `mediaUploads.${number}.failure.reason`\n | `mediaUploads.${number}.revision`,\n 5\n > & {\n __applicationErrorsType?: ListMediaUploadsApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.listMediaUploads(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n * @param locationId - ID of the location. This is Google's location identifier.\n * @public\n * @documentationMaturity preview\n * @requiredField locationId\n * @permissionId gbp:location:v1:media_upload:dismiss_media_upload_failures\n * @applicableIdentity APP\n * @fqn wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures\n */\nexport async function dismissMediaUploadFailures(\n locationId: string\n): Promise<\n NonNullablePaths<DismissMediaUploadFailuresResponse, `dismissedCount`, 2>\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n locationId: locationId,\n });\n\n const reqOpts =\n ambassadorWixGbpLocationV1MediaUpload.dismissMediaUploadFailures(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { locationId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['locationId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixGbpLocationV1MediaUploadServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'bo._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/gbp-location-service',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/gbp/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/v1/regions',\n destPath: '/v1/regions',\n },\n {\n srcPath: '/gbp/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/location/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/location/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/location/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/location/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/location/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/location/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n ],\n _: [\n {\n srcPath: '/gbp/location/v1/accounts',\n destPath: '/v1/accounts',\n },\n {\n srcPath: '/gbp/location/v1/address-schema',\n destPath: '/v1/address-schema',\n },\n {\n srcPath: '/gbp/location/v1/attribute-metadata',\n destPath: '/v1/attribute-metadata',\n },\n {\n srcPath: '/gbp/location/v1/bulk',\n destPath: '/v1/bulk',\n },\n {\n srcPath: '/gbp/location/v1/categories',\n destPath: '/v1/categories',\n },\n {\n srcPath: '/gbp/location/v1/establishments',\n destPath: '/v1/establishments',\n },\n {\n srcPath: '/gbp/location/v1/google-locations',\n destPath: '/v1/google-locations',\n },\n {\n srcPath: '/gbp/location/v1/locations',\n destPath: '/v1/locations',\n },\n {\n srcPath: '/gbp/location/v1/regions',\n destPath: '/v1/regions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_gbp_media-uploads';\n\n/**\n * Queues photo changes for one location and returns without calling Google.\n *\n * Every item must target the same `locationId`, and one call has to be either\n * all additions or all removals. Send two calls to do both.\n *\n * To add a photo, set `slotKey`, `sourceUrl`, `category` and `format`. To\n * remove one, set `slotKey` and `mediaKey`. Everything else is assigned by the\n * server.\n *\n * `sourceUrl` has to stay reachable well after this call returns, not just\n * until it does. Google fetches the image when the queue reaches it, which may\n * be minutes later, and a failure report renders the same URL as a thumbnail\n * possibly weeks later.\n *\n * Queuing clears the location's previous failures. Every failed item for the\n * location goes, not just the ones matching what you're sending, so a site\n * owner only ever sees the most recent set and retrying failures is just\n * another call to this method carrying those items.\n *\n * That clearing isn't scoped to you. If another app manages the same location,\n * queuing here discards failures it may not have read yet, and vice versa. Read\n * List Media Uploads before queuing if you need to preserve them.\n *\n * Duplicates are dropped rather than queued twice, so a double click or a\n * client retry won't add the same photo twice. An item that's already queued\n * comes back as a success carrying the existing item's `id`. Google doesn't\n * deduplicate by URL itself, so this is what protects you from a double post.\n *\n * The server decides the order, not the order you send. Every removal is\n * applied before any addition, because Google rejects new photos on a profile\n * that's already at its limit. Additions then go logo, cover, and gallery in\n * the order given.\n *\n * Errors, and in every case nothing is queued:\n * - `NOT_FOUND`: the location isn't recorded for this site.\n * - `INVALID_ARGUMENT`: items span more than one location, an item has no\n * operation set, additions and removals are mixed in one call, an addition\n * has no `sourceUrl`, or a removal has no `mediaKey`.\n * - `MEDIA_UPLOAD_INVALID_SOURCE_URL`: an addition's `sourceUrl` isn't an\n * absolute `http` or `https` URL with a host. Checked here rather than left\n * to fail against Google minutes later.\n */\nexport function bulkCreateMediaUploads(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkCreateMediaUploads({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.BulkCreateMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/bulk/media-uploads/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateMediaUploads;\n}\n\n/**\n * Retrieves the photo changes still queued or failed for a location.\n *\n * This is how you follow an asynchronous submission, since there's no\n * completion callback. Read the response as a whole rather than item by item:\n *\n * - Anything `PENDING` or `UPLOADING` means the queue is still working. Don't\n * report results yet.\n * - Only `FAILED` items means the queue finished and those items didn't make\n * it.\n * - An empty response means nothing is outstanding for this location.\n *\n * Read that last one carefully, because it's weaker than it looks. It tells you\n * the queue is empty, not that a particular submission succeeded. A successful\n * change leaves nothing behind, and so does a failure that's been cleared, and\n * the two are indistinguishable afterwards. Google's own media list is the\n * record of what's actually live, so confirm against List Media rather than\n * inferring success from an empty queue.\n *\n * Failures are cleared for the whole location by the next call to Bulk Create\n * Media Uploads, whoever makes it. If more than one app manages the same\n * location, one app queuing a change clears failures the other hasn't read yet.\n * Read failures before queuing again, and don't treat an empty response as\n * proof that your own submission worked.\n *\n * You can also use this to show a gallery matching what the site owner asked\n * for while the queue is still working, because Google's list lags behind in\n * both directions. Count only changes still on their way, since a `FAILED`\n * addition never reached Google:\n *\n * ```\n * gallery = Google's media list\n * + additions still PENDING or UPLOADING\n * - removals still PENDING or UPLOADING\n * ```\n *\n * The response is never paged and never truncated. It returns the complete set\n * or fails with `FAILED_PRECONDITION`.\n */\nexport function listMediaUploads(payload: object): RequestOptionsFactory<any> {\n function __listMediaUploads({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'GET' as any,\n methodFqn: 'wix.gbp.location.v1.MediaUploadService.ListMediaUploads',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'mediaUploads.createdDate' },\n { path: 'mediaUploads.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listMediaUploads;\n}\n\n/**\n * Clears a location's failed photo changes, leaving queued ones alone.\n *\n * Failures are otherwise kept until the next submission for that location\n * replaces them, so this is how a site owner dismisses a photo that's never\n * going to succeed.\n *\n * `dismissedCount` reports how many were cleared.\n */\nexport function dismissMediaUploadFailures(\n payload: object\n): RequestOptionsFactory<any> {\n function __dismissMediaUploadFailures({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gbp.location.v1.media_upload',\n method: 'POST' as any,\n methodFqn:\n 'wix.gbp.location.v1.MediaUploadService.DismissMediaUploadFailures',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixGbpLocationV1MediaUploadServiceUrl({\n protoPath: '/v1/locations/{locationId}/media-uploads/dismiss-failures',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __dismissMediaUploadFailures;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT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AwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,YAAY,OAAO;AAAA,QAC/C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,YAAY;AAAA,IACf;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","MediaCategory","MediaFormat","MediaUploadOperation","MediaUploadState","MediaUploadFailureReason","bulkCreateMediaUploads","listMediaUploads","dismissMediaUploadFailures"]}
|