// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * CSS API Client for Deno * ======================= * * Programmatically manage your Comparison Shopping Service (CSS) account data at scale. * * Docs: https://developers.google.com/comparison-shopping-services/api/overview * Source: https://googleapis.deno.dev/v1/css:v1.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * Programmatically manage your Comparison Shopping Service (CSS) account data * at scale. */ export class CSS { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://css.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Deletes a CSS Product input from your CSS Center account. After a delete * it may take several minutes until the input is no longer available. * * @param name Required. The name of the CSS product input resource to delete. Format: accounts/{account}/cssProductInputs/{css_product_input}, where the last section `css_product_input` consists of 3 parts: contentLanguage~feedLabel~offerId. Example: accounts/123/cssProductInputs/de~DE~rawProvidedId123 */ async accountsCssProductInputsDelete(name: string, opts: AccountsCssProductInputsDeleteOptions = {}): Promise { opts = serializeAccountsCssProductInputsDeleteOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.supplementalFeedId !== undefined) { url.searchParams.append("supplementalFeedId", String(opts.supplementalFeedId)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Empty; } /** * Uploads a CssProductInput to your CSS Center account. If an input with the * same contentLanguage, identity, feedLabel and feedId already exists, this * method replaces that entry. After inserting, updating, or deleting a CSS * Product input, it may take several minutes before the processed CSS Product * can be retrieved. * * @param parent Required. The account where this CSS Product will be inserted. Format: accounts/{account} */ async accountsCssProductInputsInsert(parent: string, req: CssProductInput, opts: AccountsCssProductInputsInsertOptions = {}): Promise { req = serializeCssProductInput(req); opts = serializeAccountsCssProductInputsInsertOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ parent }/cssProductInputs:insert`); if (opts.feedId !== undefined) { url.searchParams.append("feedId", String(opts.feedId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeCssProductInput(data); } /** * Updates the existing Css Product input in your CSS Center account. After * inserting, updating, or deleting a CSS Product input, it may take several * minutes before the processed Css Product can be retrieved. * * @param name The name of the CSS Product input. Format: `accounts/{account}/cssProductInputs/{css_product_input}`, where the last section `css_product_input` consists of 3 parts: contentLanguage~feedLabel~offerId. Example: accounts/123/cssProductInputs/de~DE~rawProvidedId123 */ async accountsCssProductInputsPatch(name: string, req: CssProductInput, opts: AccountsCssProductInputsPatchOptions = {}): Promise { req = serializeCssProductInput(req); opts = serializeAccountsCssProductInputsPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeCssProductInput(data); } /** * Retrieves the processed CSS Product from your CSS Center account. After * inserting, updating, or deleting a product input, it may take several * minutes before the updated final product can be retrieved. * * @param name Required. The name of the CSS product to retrieve. */ async accountsCssProductsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as CssProduct; } /** * Lists the processed CSS Products in your CSS Center account. The response * might contain fewer items than specified by pageSize. Rely on pageToken to * determine if there are more items to be requested. After inserting, * updating, or deleting a CSS product input, it may take several minutes * before the updated processed CSS product can be retrieved. * * @param parent Required. The account/domain to list processed CSS Products for. Format: accounts/{account} */ async accountsCssProductsList(parent: string, opts: AccountsCssProductsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/cssProducts`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListCssProductsResponse; } /** * Retrieves a single CSS/MC account by ID. * * @param name Required. The name of the managed CSS/MC account. Format: accounts/{account} */ async accountsGet(name: string, opts: AccountsGetOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.parent !== undefined) { url.searchParams.append("parent", String(opts.parent)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeAccount(data); } /** * Creates a new label, not assigned to any account. * * @param parent Required. The parent account. Format: accounts/{account} */ async accountsLabelsCreate(parent: string, req: AccountLabel): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/labels`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as AccountLabel; } /** * Deletes a label and removes it from all accounts to which it was assigned. * * @param name Required. The name of the label to delete. Format: accounts/{account}/labels/{label} */ async accountsLabelsDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Empty; } /** * Lists the labels owned by an account. * * @param parent Required. The parent account. Format: accounts/{account} */ async accountsLabelsList(parent: string, opts: AccountsLabelsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/labels`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListAccountLabelsResponse; } /** * Updates a label. * * @param name The resource name of the label. Format: accounts/{account}/labels/{label} */ async accountsLabelsPatch(name: string, req: AccountLabel): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as AccountLabel; } /** * Lists all the accounts under the specified CSS account ID, and optionally * filters by label ID and account name. * * @param parent Required. The parent account. Must be a CSS group or domain. Format: accounts/{account} */ async accountsListChildAccounts(parent: string, opts: AccountsListChildAccountsOptions = {}): Promise { opts = serializeAccountsListChildAccountsOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ parent }:listChildAccounts`); if (opts.fullName !== undefined) { url.searchParams.append("fullName", String(opts.fullName)); } if (opts.labelId !== undefined) { url.searchParams.append("labelId", String(opts.labelId)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeListChildAccountsResponse(data); } /** * Updates labels assigned to CSS/MC accounts by a CSS domain. * * @param name Required. The label resource name. Format: accounts/{account} */ async accountsUpdateLabels(name: string, req: UpdateAccountLabelsRequest): Promise { req = serializeUpdateAccountLabelsRequest(req); const url = new URL(`${this.#baseUrl}v1/${ name }:updateLabels`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeAccount(data); } } /** * Information about CSS/MC account. */ export interface Account { /** * Output only. The type of this account. */ readonly accountType?: | "ACCOUNT_TYPE_UNSPECIFIED" | "CSS_GROUP" | "CSS_DOMAIN" | "MC_PRIMARY_CSS_MCA" | "MC_CSS_MCA" | "MC_MARKETPLACE_MCA" | "MC_OTHER_MCA" | "MC_STANDALONE" | "MC_MCA_SUBACCOUNT"; /** * Automatically created label IDs assigned to the MC account by CSS Center. */ automaticLabelIds?: bigint[]; /** * The CSS/MC account's short display name. */ displayName?: string; /** * Output only. Immutable. The CSS/MC account's full name. */ readonly fullName?: string; /** * Output only. Immutable. The CSS/MC account's homepage. */ readonly homepageUri?: string; /** * Manually created label IDs assigned to the CSS/MC account by a CSS parent * account. */ labelIds?: bigint[]; /** * The label resource name. Format: accounts/{account} */ name?: string; /** * The CSS/MC account's parent resource. CSS group for CSS domains; CSS * domain for MC accounts. Returned only if the user has access to the parent * account. Note: For MC sub-accounts, this is also the CSS domain that is the * parent resource of the MCA account, since we are effectively flattening the * hierarchy." */ parent?: string; } function serializeAccount(data: any): Account { return { ...data, automaticLabelIds: data["automaticLabelIds"] !== undefined ? data["automaticLabelIds"].map((item: any) => (String(item))) : undefined, labelIds: data["labelIds"] !== undefined ? data["labelIds"].map((item: any) => (String(item))) : undefined, }; } function deserializeAccount(data: any): Account { return { ...data, automaticLabelIds: data["automaticLabelIds"] !== undefined ? data["automaticLabelIds"].map((item: any) => (BigInt(item))) : undefined, labelIds: data["labelIds"] !== undefined ? data["labelIds"].map((item: any) => (BigInt(item))) : undefined, }; } /** * Label assigned by CSS domain or CSS group to one of its sub-accounts. */ export interface AccountLabel { /** * Output only. The ID of account this label belongs to. */ readonly accountId?: bigint; /** * The description of this label. */ description?: string; /** * The display name of this label. */ displayName?: string; /** * Output only. The ID of the label. */ readonly labelId?: bigint; /** * Output only. The type of this label. */ readonly labelType?: | "LABEL_TYPE_UNSPECIFIED" | "MANUAL" | "AUTOMATIC"; /** * The resource name of the label. Format: accounts/{account}/labels/{label} */ name?: string; } /** * Additional options for CSS#accountsCssProductInputsDelete. */ export interface AccountsCssProductInputsDeleteOptions { /** * The Content API Supplemental Feed ID. The field must not be set if the * action applies to a primary feed. If the field is set, then product action * applies to a supplemental feed instead of primary Content API feed. */ supplementalFeedId?: bigint; } function serializeAccountsCssProductInputsDeleteOptions(data: any): AccountsCssProductInputsDeleteOptions { return { ...data, supplementalFeedId: data["supplementalFeedId"] !== undefined ? String(data["supplementalFeedId"]) : undefined, }; } function deserializeAccountsCssProductInputsDeleteOptions(data: any): AccountsCssProductInputsDeleteOptions { return { ...data, supplementalFeedId: data["supplementalFeedId"] !== undefined ? BigInt(data["supplementalFeedId"]) : undefined, }; } /** * Additional options for CSS#accountsCssProductInputsInsert. */ export interface AccountsCssProductInputsInsertOptions { /** * Optional. DEPRECATED. Feed id is not required for CSS Products. The * primary or supplemental feed id. If CSS Product already exists and feed id * provided is different, then the CSS Product will be moved to a new feed. * Note: For now, CSSs do not need to provide feed ids as we create feeds on * the fly. We do not have supplemental feed support for CSS Products yet. */ feedId?: bigint; } function serializeAccountsCssProductInputsInsertOptions(data: any): AccountsCssProductInputsInsertOptions { return { ...data, feedId: data["feedId"] !== undefined ? String(data["feedId"]) : undefined, }; } function deserializeAccountsCssProductInputsInsertOptions(data: any): AccountsCssProductInputsInsertOptions { return { ...data, feedId: data["feedId"] !== undefined ? BigInt(data["feedId"]) : undefined, }; } /** * Additional options for CSS#accountsCssProductInputsPatch. */ export interface AccountsCssProductInputsPatchOptions { /** * The list of CSS product attributes to be updated. If the update mask is * omitted, then it is treated as implied field mask equivalent to all fields * that are populated (have a non-empty value). Attributes specified in the * update mask without a value specified in the body will be deleted from the * CSS product. Update mask can only be specified for top level fields in * attributes and custom attributes. To specify the update mask for custom * attributes you need to add the `custom_attribute.` prefix. Providing * special "*" value for full CSS product replacement is not supported. */ updateMask?: string /* FieldMask */; } function serializeAccountsCssProductInputsPatchOptions(data: any): AccountsCssProductInputsPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeAccountsCssProductInputsPatchOptions(data: any): AccountsCssProductInputsPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for CSS#accountsCssProductsList. */ export interface AccountsCssProductsListOptions { /** * The maximum number of CSS Products to return. The service may return fewer * than this value. The maximum value is 1000; values above 1000 will be * coerced to 1000. If unspecified, the maximum number of CSS products will be * returned. */ pageSize?: number; /** * A page token, received from a previous `ListCssProducts` call. Provide * this to retrieve the subsequent page. When paginating, all other parameters * provided to `ListCssProducts` must match the call that provided the page * token. */ pageToken?: string; } /** * Additional options for CSS#accountsGet. */ export interface AccountsGetOptions { /** * Optional. Only required when retrieving MC account information. The CSS * domain that is the parent resource of the MC account. Format: * accounts/{account} */ parent?: string; } /** * Additional options for CSS#accountsLabelsList. */ export interface AccountsLabelsListOptions { /** * The maximum number of labels to return. The service may return fewer than * this value. If unspecified, at most 50 labels will be returned. The maximum * value is 1000; values above 1000 will be coerced to 1000. */ pageSize?: number; /** * A page token, received from a previous `ListAccountLabels` call. Provide * this to retrieve the subsequent page. When paginating, all other parameters * provided to `ListAccountLabels` must match the call that provided the page * token. */ pageToken?: string; } /** * Additional options for CSS#accountsListChildAccounts. */ export interface AccountsListChildAccountsOptions { /** * If set, only the MC accounts with the given name (case sensitive) will be * returned. */ fullName?: string; /** * If set, only the MC accounts with the given label ID will be returned. */ labelId?: bigint; /** * Optional. The maximum number of accounts to return. The service may return * fewer than this value. If unspecified, at most 50 accounts will be * returned. The maximum value is 100; values above 100 will be coerced to * 100. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListChildAccounts` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListChildAccounts` must match the call that * provided the page token. */ pageToken?: string; } function serializeAccountsListChildAccountsOptions(data: any): AccountsListChildAccountsOptions { return { ...data, labelId: data["labelId"] !== undefined ? String(data["labelId"]) : undefined, }; } function deserializeAccountsListChildAccountsOptions(data: any): AccountsListChildAccountsOptions { return { ...data, labelId: data["labelId"] !== undefined ? BigInt(data["labelId"]) : undefined, }; } /** * Attributes for CSS Product. */ export interface Attributes { /** * Additional URL of images of the item. */ additionalImageLinks?: string[]; /** * Set to true if the item is targeted towards adults. */ adult?: boolean; /** * Target age group of the item. */ ageGroup?: string; /** * Product Related Attributes.[14-36] Brand of the item. */ brand?: string; /** * A list of certificates claimed by the CSS for the given product. */ certifications?: Certification[]; /** * Color of the item. */ color?: string; /** * Allows advertisers to override the item URL when the product is shown * within the context of Product Ads. */ cppAdsRedirect?: string; /** * URL directly linking to your the Product Detail Page of the CSS. */ cppLink?: string; /** * URL for the mobile-optimized version of the Product Detail Page of the * CSS. */ cppMobileLink?: string; /** * Custom label 0 for custom grouping of items in a Shopping campaign. */ customLabel0?: string; /** * Custom label 1 for custom grouping of items in a Shopping campaign. */ customLabel1?: string; /** * Custom label 2 for custom grouping of items in a Shopping campaign. */ customLabel2?: string; /** * Custom label 3 for custom grouping of items in a Shopping campaign. */ customLabel3?: string; /** * Custom label 4 for custom grouping of items in a Shopping campaign. */ customLabel4?: string; /** * Description of the item. */ description?: string; /** * The list of destinations to exclude for this target (corresponds to * unchecked check boxes in Merchant Center). */ excludedDestinations?: string[]; /** * Date on which the item should expire, as specified upon insertion, in [ISO * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. The actual expiration * date is exposed in `productstatuses` as * [googleExpirationDate](https://support.google.com/merchants/answer/6324499) * and might be earlier if `expirationDate` is too far in the future. Note: It * may take 2+ days from the expiration date for the item to actually get * deleted. */ expirationDate?: Date; /** * Target gender of the item. */ gender?: string; /** * Google's category of the item (see [Google product * taxonomy](https://support.google.com/merchants/answer/1705911)). When * querying products, this field will contain the user provided value. There * is currently no way to get back the auto assigned google product categories * through the API. */ googleProductCategory?: string; /** * Global Trade Item Number * ([GTIN](https://support.google.com/merchants/answer/188494#gtin)) of the * item. */ gtin?: string; /** * Condition of the headline offer. */ headlineOfferCondition?: string; /** * Number and amount of installments to pay for an item. */ headlineOfferInstallment?: HeadlineOfferInstallment; /** * Link to the headline offer. */ headlineOfferLink?: string; /** * Mobile Link to the headline offer. */ headlineOfferMobileLink?: string; /** * Headline Price of the CSS Product. */ headlineOfferPrice?: Price; /** * Headline Price of the CSS Product. */ headlineOfferShippingPrice?: Price; /** * Number of periods (months or years) and amount of payment per period for * an item with an associated subscription contract. */ headlineOfferSubscriptionCost?: HeadlineOfferSubscriptionCost; /** * High Price of the CSS Product. */ highPrice?: Price; /** * URL of an image of the item. */ imageLink?: string; /** * The list of destinations to include for this target (corresponds to * checked check boxes in Merchant Center). Default destinations are always * included unless provided in `excludedDestinations`. */ includedDestinations?: string[]; /** * Whether the item is a merchant-defined bundle. A bundle is a custom * grouping of different products sold by a merchant for a single price. */ isBundle?: boolean; /** * Shared identifier for all variants of the same product. */ itemGroupId?: string; /** * Low Price of the CSS Product. */ lowPrice?: Price; /** * The material of which the item is made. */ material?: string; /** * Manufacturer Part Number * ([MPN](https://support.google.com/merchants/answer/188494#mpn)) of the * item. */ mpn?: string; /** * The number of identical products in a merchant-defined multipack. */ multipack?: bigint; /** * The number of CSS Products. */ numberOfOffers?: bigint; /** * The item's pattern (e.g. polka dots). */ pattern?: string; /** * Publication of this item will be temporarily paused. */ pause?: string; /** * Technical specification or additional product details. */ productDetails?: ProductDetail[]; /** * The height of the product in the units provided. The value must be between * 0 (exclusive) and 3000 (inclusive). */ productHeight?: ProductDimension; /** * Bullet points describing the most relevant highlights of a product. */ productHighlights?: string[]; /** * The length of the product in the units provided. The value must be between * 0 (exclusive) and 3000 (inclusive). */ productLength?: ProductDimension; /** * Categories of the item (formatted as in [products data * specification](https://support.google.com/merchants/answer/6324406)). */ productTypes?: string[]; /** * The weight of the product in the units provided. The value must be between * 0 (exclusive) and 2000 (inclusive). */ productWeight?: ProductWeight; /** * The width of the product in the units provided. The value must be between * 0 (exclusive) and 3000 (inclusive). */ productWidth?: ProductDimension; /** * Size of the item. Only one value is allowed. For variants with different * sizes, insert a separate product for each size with the same `itemGroupId` * value (see [https://support.google.com/merchants/answer/6324492](size * definition)). */ size?: string; /** * System in which the size is specified. Recommended for apparel items. */ sizeSystem?: string; /** * The cut of the item. It can be used to represent combined size types for * apparel items. Maximum two of size types can be provided (see * [https://support.google.com/merchants/answer/6324497](size type)). */ sizeTypes?: string[]; /** * Title of the item. */ title?: string; } function serializeAttributes(data: any): Attributes { return { ...data, expirationDate: data["expirationDate"] !== undefined ? data["expirationDate"].toISOString() : undefined, headlineOfferInstallment: data["headlineOfferInstallment"] !== undefined ? serializeHeadlineOfferInstallment(data["headlineOfferInstallment"]) : undefined, headlineOfferPrice: data["headlineOfferPrice"] !== undefined ? serializePrice(data["headlineOfferPrice"]) : undefined, headlineOfferShippingPrice: data["headlineOfferShippingPrice"] !== undefined ? serializePrice(data["headlineOfferShippingPrice"]) : undefined, headlineOfferSubscriptionCost: data["headlineOfferSubscriptionCost"] !== undefined ? serializeHeadlineOfferSubscriptionCost(data["headlineOfferSubscriptionCost"]) : undefined, highPrice: data["highPrice"] !== undefined ? serializePrice(data["highPrice"]) : undefined, lowPrice: data["lowPrice"] !== undefined ? serializePrice(data["lowPrice"]) : undefined, multipack: data["multipack"] !== undefined ? String(data["multipack"]) : undefined, numberOfOffers: data["numberOfOffers"] !== undefined ? String(data["numberOfOffers"]) : undefined, }; } function deserializeAttributes(data: any): Attributes { return { ...data, expirationDate: data["expirationDate"] !== undefined ? new Date(data["expirationDate"]) : undefined, headlineOfferInstallment: data["headlineOfferInstallment"] !== undefined ? deserializeHeadlineOfferInstallment(data["headlineOfferInstallment"]) : undefined, headlineOfferPrice: data["headlineOfferPrice"] !== undefined ? deserializePrice(data["headlineOfferPrice"]) : undefined, headlineOfferShippingPrice: data["headlineOfferShippingPrice"] !== undefined ? deserializePrice(data["headlineOfferShippingPrice"]) : undefined, headlineOfferSubscriptionCost: data["headlineOfferSubscriptionCost"] !== undefined ? deserializeHeadlineOfferSubscriptionCost(data["headlineOfferSubscriptionCost"]) : undefined, highPrice: data["highPrice"] !== undefined ? deserializePrice(data["highPrice"]) : undefined, lowPrice: data["lowPrice"] !== undefined ? deserializePrice(data["lowPrice"]) : undefined, multipack: data["multipack"] !== undefined ? BigInt(data["multipack"]) : undefined, numberOfOffers: data["numberOfOffers"] !== undefined ? BigInt(data["numberOfOffers"]) : undefined, }; } /** * The certification for the product. Use the this attribute to describe * certifications, such as energy efficiency ratings, associated with a product. */ export interface Certification { /** * The authority or certification body responsible for issuing the * certification. At this time, the most common value is "EC" or * “European_Commission” for energy labels in the EU. */ authority?: string; /** * The code of the certification. For example, for the EPREL certificate with * the link https://eprel.ec.europa.eu/screen/product/dishwashers2019/123456 * the code is 123456. The code is required for European Energy Labels. */ code?: string; /** * The name of the certification. At this time, the most common value is * "EPREL", which represents energy efficiency certifications in the EU * European Registry for Energy Labeling (EPREL) database. */ name?: string; } /** * The processed CSS Product. */ export interface CssProduct { /** * Output only. A list of product attributes. */ readonly attributes?: Attributes; /** * Output only. The two-letter [ISO * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the * product. */ readonly contentLanguage?: string; /** * Output only. The status of a product, data validation issues, that is, * information about a product computed asynchronously. */ readonly cssProductStatus?: CssProductStatus; /** * Output only. A list of custom (CSS-provided) attributes. It can also be * used to submit any attribute of the feed specification in its generic form * (for example, `{ "name": "size type", "value": "regular" }`). This is * useful for submitting attributes not explicitly exposed by the API, such as * additional attributes used for Buy on Google. */ readonly customAttributes?: CustomAttribute[]; /** * Output only. The feed label for the product. */ readonly feedLabel?: string; /** * The name of the CSS Product. Format: * `"accounts/{account}/cssProducts/{css_product}"` */ name?: string; /** * Output only. Your unique raw identifier for the product. */ readonly rawProvidedId?: string; } /** * This resource represents input data you submit for a CSS Product, not the * processed CSS Product that you see in CSS Center, in Shopping Ads, or across * Google surfaces. */ export interface CssProductInput { /** * A list of CSS Product attributes. */ attributes?: Attributes; /** * Required. The two-letter [ISO * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS * Product. */ contentLanguage?: string; /** * A list of custom (CSS-provided) attributes. It can also be used for * submitting any attribute of the feed specification in its generic form (for * example: `{ "name": "size type", "value": "regular" }`). This is useful for * submitting attributes not explicitly exposed by the API, such as additional * attributes used for Buy on Google. */ customAttributes?: CustomAttribute[]; /** * Required. The [feed * label](https://developers.google.com/shopping-content/guides/products/feed-labels) * for the CSS Product. Feed Label is synonymous to "target country" and hence * should always be a valid region code. For example: 'DE' for Germany, 'FR' * for France. */ feedLabel?: string; /** * Output only. The name of the processed CSS Product. Format: * `accounts/{account}/cssProducts/{css_product}` " */ readonly finalName?: string; /** * DEPRECATED. Use expiration_date instead. Represents the existing version * (freshness) of the CSS Product, which can be used to preserve the right * order when multiple updates are done at the same time. This field must not * be set to the future time. If set, the update is prevented if a newer * version of the item already exists in our system (that is the last update * time of the existing CSS products is later than the freshness time set in * the update). If the update happens, the last update time is then set to * this freshness time. If not set, the update will not be prevented and the * last update time will default to when this request was received by the CSS * API. If the operation is prevented, the aborted exception will be thrown. */ freshnessTime?: Date; /** * The name of the CSS Product input. Format: * `accounts/{account}/cssProductInputs/{css_product_input}`, where the last * section `css_product_input` consists of 3 parts: * contentLanguage~feedLabel~offerId. Example: * accounts/123/cssProductInputs/de~DE~rawProvidedId123 */ name?: string; /** * Required. Your unique identifier for the CSS Product. This is the same for * the CSS Product input and processed CSS Product. We only allow ids with * alphanumerics, underscores and dashes. See the [products feed * specification](https://support.google.com/merchants/answer/188494#id) for * details. */ rawProvidedId?: string; } function serializeCssProductInput(data: any): CssProductInput { return { ...data, attributes: data["attributes"] !== undefined ? serializeAttributes(data["attributes"]) : undefined, freshnessTime: data["freshnessTime"] !== undefined ? data["freshnessTime"].toISOString() : undefined, }; } function deserializeCssProductInput(data: any): CssProductInput { return { ...data, attributes: data["attributes"] !== undefined ? deserializeAttributes(data["attributes"]) : undefined, freshnessTime: data["freshnessTime"] !== undefined ? new Date(data["freshnessTime"]) : undefined, }; } /** * The status of the Css Product, data validation issues, that is, information * about the Css Product computed asynchronously. */ export interface CssProductStatus { /** * Date on which the item has been created, in [ISO * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. */ creationDate?: Date; /** * The intended destinations for the product. */ destinationStatuses?: DestinationStatus[]; /** * Date on which the item expires, in [ISO * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. */ googleExpirationDate?: Date; /** * A list of all issues associated with the product. */ itemLevelIssues?: ItemLevelIssue[]; /** * Date on which the item has been last updated, in [ISO * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. */ lastUpdateDate?: Date; } function serializeCssProductStatus(data: any): CssProductStatus { return { ...data, creationDate: data["creationDate"] !== undefined ? data["creationDate"].toISOString() : undefined, googleExpirationDate: data["googleExpirationDate"] !== undefined ? data["googleExpirationDate"].toISOString() : undefined, lastUpdateDate: data["lastUpdateDate"] !== undefined ? data["lastUpdateDate"].toISOString() : undefined, }; } function deserializeCssProductStatus(data: any): CssProductStatus { return { ...data, creationDate: data["creationDate"] !== undefined ? new Date(data["creationDate"]) : undefined, googleExpirationDate: data["googleExpirationDate"] !== undefined ? new Date(data["googleExpirationDate"]) : undefined, lastUpdateDate: data["lastUpdateDate"] !== undefined ? new Date(data["lastUpdateDate"]) : undefined, }; } /** * A message that represents custom attributes. Exactly one of `value` or * `group_values` must not be empty. */ export interface CustomAttribute { /** * Subattributes within this attribute group. If `group_values` is not empty, * `value` must be empty. */ groupValues?: CustomAttribute[]; /** * The name of the attribute. */ name?: string; /** * The value of the attribute. If `value` is not empty, `group_values` must * be empty. */ value?: string; } /** * The destination status of the product status. */ export interface DestinationStatus { /** * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * approved. */ approvedCountries?: string[]; /** * The name of the destination */ destination?: string; /** * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * disapproved. */ disapprovedCountries?: string[]; /** * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * pending approval. */ pendingCountries?: string[]; } /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request or * the response type of an API method. For instance: service Foo { rpc * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } */ export interface Empty { } /** * A message that represents installment. */ export interface HeadlineOfferInstallment { /** * The amount the buyer has to pay per month. */ amount?: Price; /** * The up-front down payment amount the buyer has to pay. */ downpayment?: Price; /** * The number of installments the buyer has to pay. */ months?: bigint; } function serializeHeadlineOfferInstallment(data: any): HeadlineOfferInstallment { return { ...data, amount: data["amount"] !== undefined ? serializePrice(data["amount"]) : undefined, downpayment: data["downpayment"] !== undefined ? serializePrice(data["downpayment"]) : undefined, months: data["months"] !== undefined ? String(data["months"]) : undefined, }; } function deserializeHeadlineOfferInstallment(data: any): HeadlineOfferInstallment { return { ...data, amount: data["amount"] !== undefined ? deserializePrice(data["amount"]) : undefined, downpayment: data["downpayment"] !== undefined ? deserializePrice(data["downpayment"]) : undefined, months: data["months"] !== undefined ? BigInt(data["months"]) : undefined, }; } /** * The SubscriptionCost of the product. */ export interface HeadlineOfferSubscriptionCost { /** * The amount the buyer has to pay per subscription period. */ amount?: Price; /** * The type of subscription period. Supported values are: * "`month`" * * "`year`" */ period?: | "SUBSCRIPTION_PERIOD_UNSPECIFIED" | "MONTH" | "YEAR"; /** * The number of subscription periods the buyer has to pay. */ periodLength?: bigint; } function serializeHeadlineOfferSubscriptionCost(data: any): HeadlineOfferSubscriptionCost { return { ...data, amount: data["amount"] !== undefined ? serializePrice(data["amount"]) : undefined, periodLength: data["periodLength"] !== undefined ? String(data["periodLength"]) : undefined, }; } function deserializeHeadlineOfferSubscriptionCost(data: any): HeadlineOfferSubscriptionCost { return { ...data, amount: data["amount"] !== undefined ? deserializePrice(data["amount"]) : undefined, periodLength: data["periodLength"] !== undefined ? BigInt(data["periodLength"]) : undefined, }; } /** * The ItemLevelIssue of the product status. */ export interface ItemLevelIssue { /** * List of country codes (ISO 3166-1 alpha-2) where issue applies to the CSS * Product. */ applicableCountries?: string[]; /** * The attribute's name, if the issue is caused by a single attribute. */ attribute?: string; /** * The error code of the issue. */ code?: string; /** * A short issue description in English. */ description?: string; /** * The destination the issue applies to. */ destination?: string; /** * A detailed issue description in English. */ detail?: string; /** * The URL of a web page to help with resolving this issue. */ documentation?: string; /** * Whether the issue can be resolved by the merchant. */ resolution?: string; /** * How this issue affects serving of the CSS Product. */ servability?: string; } /** * Response message for the `ListAccountLabels` method. */ export interface ListAccountLabelsResponse { /** * The labels from the specified account. */ accountLabels?: AccountLabel[]; /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; } /** * Response message for the `ListChildAccounts` method. */ export interface ListChildAccountsResponse { /** * The CSS/MC accounts returned for the specified CSS parent account. */ accounts?: Account[]; /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; } function serializeListChildAccountsResponse(data: any): ListChildAccountsResponse { return { ...data, accounts: data["accounts"] !== undefined ? data["accounts"].map((item: any) => (serializeAccount(item))) : undefined, }; } function deserializeListChildAccountsResponse(data: any): ListChildAccountsResponse { return { ...data, accounts: data["accounts"] !== undefined ? data["accounts"].map((item: any) => (deserializeAccount(item))) : undefined, }; } /** * Response message for the ListCssProducts method. */ export interface ListCssProductsResponse { /** * The processed CSS products from the specified account. These are your * processed CSS products after applying rules and supplemental feeds. */ cssProducts?: CssProduct[]; /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; } /** * The price represented as a number and currency. */ export interface Price { /** * The price represented as a number in micros (1 million micros is an * equivalent to one's currency standard unit, for example, 1 USD = 1000000 * micros). */ amountMicros?: bigint; /** * The currency of the price using three-letter acronyms according to [ISO * 4217](http://en.wikipedia.org/wiki/ISO_4217). */ currencyCode?: string; } function serializePrice(data: any): Price { return { ...data, amountMicros: data["amountMicros"] !== undefined ? String(data["amountMicros"]) : undefined, }; } function deserializePrice(data: any): Price { return { ...data, amountMicros: data["amountMicros"] !== undefined ? BigInt(data["amountMicros"]) : undefined, }; } /** * The product details. */ export interface ProductDetail { /** * The name of the product detail. */ attributeName?: string; /** * The value of the product detail. */ attributeValue?: string; /** * The section header used to group a set of product details. */ sectionName?: string; } /** * The dimension of the product. */ export interface ProductDimension { /** * Required. The dimension units. Acceptable values are: * "`in`" * "`cm`" */ unit?: string; /** * Required. The dimension value represented as a number. The value can have * a maximum precision of four decimal places. */ value?: number; } /** * The weight of the product. */ export interface ProductWeight { /** * Required. The weight unit. Acceptable values are: * "`g`" * "`kg`" * * "`oz`" * "`lb`" */ unit?: string; /** * Required. The weight represented as a number. The weight can have a * maximum precision of four decimal places. */ value?: number; } /** * The request message for the `UpdateLabels` method. */ export interface UpdateAccountLabelsRequest { /** * The list of label IDs to overwrite the existing account label IDs. If the * list is empty, all currently assigned label IDs will be deleted. */ labelIds?: bigint[]; /** * Optional. Only required when updating MC account labels. The CSS domain * that is the parent resource of the MC account. Format: accounts/{account} */ parent?: string; } function serializeUpdateAccountLabelsRequest(data: any): UpdateAccountLabelsRequest { return { ...data, labelIds: data["labelIds"] !== undefined ? data["labelIds"].map((item: any) => (String(item))) : undefined, }; } function deserializeUpdateAccountLabelsRequest(data: any): UpdateAccountLabelsRequest { return { ...data, labelIds: data["labelIds"] !== undefined ? data["labelIds"].map((item: any) => (BigInt(item))) : undefined, }; }