1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
// This file is @generated by prost-build.
/// Attributes.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attributes {
/// Required. Applicability of the promotion to either all products or
/// [only specific
/// products](<https://support.google.com/merchants/answer/6396257?ref_topic=6396150&sjid=17642868584668136159-NC>).
#[prost(enumeration = "ProductApplicability", tag = "1")]
pub product_applicability: i32,
/// Required.
/// [Type](<https://support.google.com/merchants/answer/13837405?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// of the promotion. Use this attribute to indicate whether or not customers
/// need a coupon code to redeem your promotion.
#[prost(enumeration = "OfferType", tag = "2")]
pub offer_type: i32,
/// Optional. Generic redemption code for the promotion. To be used with the
/// `offerType` field and must meet the [minimum
/// requirements](<https://support.google.com/merchants/answer/13837405?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, tag = "3")]
pub generic_redemption_code: ::prost::alloc::string::String,
/// Required. [Long
/// title](<https://support.google.com/merchants/answer/13838102?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(string, tag = "4")]
pub long_title: ::prost::alloc::string::String,
/// Required. The \[coupon value type\]
/// (<https://support.google.com/merchants/answer/13861986?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// attribute to signal the type of promotion that you are running. Depending
/// on type of the selected coupon value [some attributes are
/// required](<https://support.google.com/merchants/answer/6393006?ref_topic=7322920>).
#[prost(enumeration = "CouponValueType", tag = "5")]
pub coupon_value_type: i32,
/// Required. The list of destinations where the promotion applies to. If you
/// don't specify a destination by including a supported value in your data
/// source, your promotion will display in Shopping ads and free listings by
/// default.
///
/// You may have previously submitted the following values as destinations for
/// your products: Shopping Actions, Surfaces across Google, Local surfaces
/// across Google. To represent these values use `FREE_LISTINGS`,
/// `FREE_LOCAL_LISTINGS`, `LOCAL_INVENTORY_ADS`. For more details see
/// [Promotion
/// destination](<https://support.google.com/merchants/answer/13837465?sjid=5155774230887277618-NC>)
#[prost(
enumeration = "super::super::super::r#type::destination::DestinationEnum",
repeated,
packed = "false",
tag = "6"
)]
pub promotion_destinations: ::prost::alloc::vec::Vec<i32>,
/// Optional. Product filter by [item
/// ID](<https://support.google.com/merchants/answer/13861565?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The product filter attributes only applies when the
/// products eligible for promotion product applicability
/// `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "7")]
pub item_id_inclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. Product filter by brand for the promotion. The product filter
/// attributes only applies when the products eligible for promotion product
/// applicability `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "8")]
pub brand_inclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. Product filter by item group ID for the promotion. The product
/// filter attributes only applies when the products eligible for promotion
/// product applicability \[product_applicability\] attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "9")]
pub item_group_id_inclusion: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
/// Optional. Product filter by product type for the promotion. The product
/// filter attributes only applies when the products eligible for promotion
/// product applicability `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "10")]
pub product_type_inclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. Product filter by [item ID
/// exclusion](<https://support.google.com/merchants/answer/13863524?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The product filter attributes only applies when the
/// products eligible for promotion product applicability
/// `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "11")]
pub item_id_exclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. Product filter by [brand
/// exclusion](<https://support.google.com/merchants/answer/13861679?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The product filter attributes only applies when the
/// products eligible for promotion product applicability
/// `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "12")]
pub brand_exclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. Product filter by [item group
/// ID](<https://support.google.com/merchants/answer/13837298?ref_topic=13773355&sjid=17642868584668136159-NC>).
/// The product filter attributes only applies when the products eligible for
/// promotion product applicability `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
/// exclusion for the promotion.
#[prost(string, repeated, tag = "13")]
pub item_group_id_exclusion: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
/// Optional. Product filter by [product type
/// exclusion](<https://support.google.com/merchants/answer/13863746?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The product filter attributes only applies when the
/// products eligible for promotion product applicability
/// `product_applicability` attribute is set to
/// [specific_products](<https://support.google.com/merchants/answer/13837299?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "14")]
pub product_type_exclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. [Minimum purchase
/// amount](<https://support.google.com/merchants/answer/13837705?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(message, optional, tag = "15")]
pub minimum_purchase_amount: ::core::option::Option<
super::super::super::r#type::Price,
>,
/// Optional. [Minimum purchase
/// quantity](<https://support.google.com/merchants/answer/13838182?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(int64, tag = "16")]
pub minimum_purchase_quantity: i64,
/// Optional. [Maximum purchase
/// quantity](<https://support.google.com/merchants/answer/13861564?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(int64, tag = "17")]
pub limit_quantity: i64,
/// Optional. [Maximum product
/// price](<https://support.google.com/merchants/answer/2906014>) for
/// promotion.
#[prost(message, optional, tag = "18")]
pub limit_value: ::core::option::Option<super::super::super::r#type::Price>,
/// Optional. The [percentage
/// discount](<https://support.google.com/merchants/answer/13837404?sjid=17642868584668136159-NC>)
/// offered in the promotion.
#[prost(int64, tag = "19")]
pub percent_off: i64,
/// Optional. The [money off
/// amount](<https://support.google.com/merchants/answer/13838101?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// offered in the promotion.
#[prost(message, optional, tag = "20")]
pub money_off_amount: ::core::option::Option<super::super::super::r#type::Price>,
/// Optional. The number of items discounted in the promotion. The attribute is
/// set when `couponValueType` is equal to `buy_m_get_n_money_off` or
/// `buy_m_get_n_percent_off`.
#[prost(int64, tag = "21")]
pub get_this_quantity_discounted: i64,
/// Optional. [Free gift
/// value](<https://support.google.com/merchants/answer/13844477?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(message, optional, tag = "22")]
pub free_gift_value: ::core::option::Option<super::super::super::r#type::Price>,
/// Optional. [Free gift
/// description](<https://support.google.com/merchants/answer/13847245?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(string, tag = "23")]
pub free_gift_description: ::prost::alloc::string::String,
/// Optional. [Free gift item
/// ID](<https://support.google.com/merchants/answer/13857152?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion.
#[prost(string, tag = "24")]
pub free_gift_item_id: ::prost::alloc::string::String,
/// Required. `TimePeriod` representation of the promotion's effective dates.
/// This attribute specifies that the promotion can be tested on your online
/// store during this time period.
#[prost(message, optional, tag = "25")]
pub promotion_effective_time_period: ::core::option::Option<
super::super::super::super::r#type::Interval,
>,
/// Optional. `TimePeriod` representation of the promotion's display dates.
/// This attribute specifies the date and time frame when the promotion will be
/// live on Google.com and Shopping ads. If the display time period for
/// promotion `promotion_display_time_period` attribute is not specified, the
/// promotion effective time period `promotion_effective_time_period`
/// determines the date and time frame when the promotion will be live on
/// Google.com and Shopping ads.
#[prost(message, optional, tag = "26")]
pub promotion_display_time_period: ::core::option::Option<
super::super::super::super::r#type::Interval,
>,
/// Optional. Whether the promotion applies to [all stores, or only specified
/// stores](<https://support.google.com/merchants/answer/13857563?sjid=17642868584668136159-NC>).
/// Local Inventory ads promotions throw an error if no store applicability is
/// included. An `INVALID_ARGUMENT` error is thrown if `store_applicability` is
/// set to `ALL_STORES` and `store_codes_inclusion` or `score_code_exclusion`
/// is set to a value.
#[prost(enumeration = "StoreApplicability", tag = "28")]
pub store_applicability: i32,
/// Optional. [Store codes to
/// include](<https://support.google.com/merchants/answer/13857470?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The store filter attributes only applies when the
/// `store_applicability` attribute is set to
/// [specific_stores](<https://support.google.com/merchants/answer/13857563?ref_topic=13773355&sjid=17642868584668136159-NC>).
///
/// Store code (the store ID from
/// your Business Profile) of the physical store the product is sold in. See
/// the [Local product inventory data
/// specification](<https://support.google.com/merchants/answer/3061342>) for
/// more information.
#[prost(string, repeated, tag = "29")]
pub store_codes_inclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. [Store codes to
/// exclude](<https://support.google.com/merchants/answer/13859586?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. The store filter attributes only applies when the
/// `store_applicability` attribute is set to
/// [specific_stores](<https://support.google.com/merchants/answer/13857563?ref_topic=13773355&sjid=17642868584668136159-NC>).
#[prost(string, repeated, tag = "30")]
pub store_codes_exclusion: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. URL to the page on the merchant's site where the promotion shows.
/// Local Inventory ads promotions throw an error if no `promotion_url` is
/// included. URL is used to confirm that the promotion is valid and can be
/// redeemed.
#[prost(string, tag = "31")]
pub promotion_url: ::prost::alloc::string::String,
}
/// The status of the promotion.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PromotionStatus {
/// Output only. The intended destinations for the promotion.
#[prost(message, repeated, tag = "1")]
pub destination_statuses: ::prost::alloc::vec::Vec<
promotion_status::DestinationStatus,
>,
/// Output only. A list of issues associated with the promotion.
#[prost(message, repeated, tag = "2")]
pub item_level_issues: ::prost::alloc::vec::Vec<promotion_status::ItemLevelIssue>,
/// Output only. Date on which the promotion has been created
/// in [ISO 8601](<http://en.wikipedia.org/wiki/ISO_8601>) format: Date, time,
/// and offset, for example `2020-01-02T09:00:00+01:00` or
/// `2020-01-02T09:00:00Z`
#[prost(message, optional, tag = "3")]
pub creation_date: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. Date on which the promotion status has been last updated
/// in [ISO 8601](<http://en.wikipedia.org/wiki/ISO_8601>) format: Date, time,
/// and offset, for example `2020-01-02T09:00:00+01:00` or
/// `2020-01-02T09:00:00Z`
#[prost(message, optional, tag = "4")]
pub last_update_date: ::core::option::Option<::prost_types::Timestamp>,
}
/// Nested message and enum types in `PromotionStatus`.
pub mod promotion_status {
/// The status for the specified destination.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DestinationStatus {
/// Output only. The name of the promotion destination.
#[prost(
enumeration = "super::super::super::super::r#type::reporting_context::ReportingContextEnum",
tag = "1"
)]
pub reporting_context: i32,
/// Output only. The status for the specified destination.
#[prost(enumeration = "destination_status::State", tag = "2")]
pub status: i32,
}
/// Nested message and enum types in `DestinationStatus`.
pub mod destination_status {
/// The current state of the promotion.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Unknown promotion state.
Unspecified = 0,
/// The promotion is under review.
InReview = 1,
/// The promotion is disapproved.
Rejected = 2,
/// The promotion is approved and active.
Live = 3,
/// The promotion is stopped by merchant.
Stopped = 4,
/// The promotion is no longer active.
Expired = 5,
/// The promotion is not stopped, and all reviews are approved, but the
/// active date is in the future.
Pending = 6,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::InReview => "IN_REVIEW",
State::Rejected => "REJECTED",
State::Live => "LIVE",
State::Stopped => "STOPPED",
State::Expired => "EXPIRED",
State::Pending => "PENDING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"IN_REVIEW" => Some(Self::InReview),
"REJECTED" => Some(Self::Rejected),
"LIVE" => Some(Self::Live),
"STOPPED" => Some(Self::Stopped),
"EXPIRED" => Some(Self::Expired),
"PENDING" => Some(Self::Pending),
_ => None,
}
}
}
}
/// The issue associated with the promotion.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ItemLevelIssue {
/// Output only. The error code of the issue.
#[prost(string, tag = "1")]
pub code: ::prost::alloc::string::String,
/// Output only. How this issue affects serving of the promotion.
#[prost(enumeration = "item_level_issue::Severity", tag = "2")]
pub severity: i32,
/// Output only. Whether the issue can be resolved by the merchant.
#[prost(string, tag = "3")]
pub resolution: ::prost::alloc::string::String,
/// Output only. The attribute's name, if the issue is caused by a single
/// attribute.
#[prost(string, tag = "4")]
pub attribute: ::prost::alloc::string::String,
/// Output only. The destination the issue applies to.
#[prost(
enumeration = "super::super::super::super::r#type::reporting_context::ReportingContextEnum",
tag = "5"
)]
pub reporting_context: i32,
/// Output only. A short issue description in English.
#[prost(string, tag = "6")]
pub description: ::prost::alloc::string::String,
/// Output only. A detailed issue description in English.
#[prost(string, tag = "7")]
pub detail: ::prost::alloc::string::String,
/// Output only. The URL of a web page to help with resolving this issue.
#[prost(string, tag = "8")]
pub documentation: ::prost::alloc::string::String,
/// Output only. List of country codes (ISO 3166-1 alpha-2) where issue
/// applies to the offer.
#[prost(string, repeated, tag = "9")]
pub applicable_countries: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
}
/// Nested message and enum types in `ItemLevelIssue`.
pub mod item_level_issue {
/// The severity of the issue.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Severity {
/// Not specified.
Unspecified = 0,
/// This issue represents a warning and does not have a direct affect
/// on the promotion.
NotImpacted = 1,
/// The promotion is demoted and most likely have limited performance
/// in search results
Demoted = 2,
/// Issue disapproves the promotion.
Disapproved = 3,
}
impl Severity {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Severity::Unspecified => "SEVERITY_UNSPECIFIED",
Severity::NotImpacted => "NOT_IMPACTED",
Severity::Demoted => "DEMOTED",
Severity::Disapproved => "DISAPPROVED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SEVERITY_UNSPECIFIED" => Some(Self::Unspecified),
"NOT_IMPACTED" => Some(Self::NotImpacted),
"DEMOTED" => Some(Self::Demoted),
"DISAPPROVED" => Some(Self::Disapproved),
_ => None,
}
}
}
}
}
/// Which product or list of products the promotion applies to.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProductApplicability {
/// Which products the promotion applies to is unknown.
Unspecified = 0,
/// Applicable to all products.
AllProducts = 1,
/// Applicable to only a single product or list of products.
SpecificProducts = 2,
}
impl ProductApplicability {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ProductApplicability::Unspecified => "PRODUCT_APPLICABILITY_UNSPECIFIED",
ProductApplicability::AllProducts => "ALL_PRODUCTS",
ProductApplicability::SpecificProducts => "SPECIFIC_PRODUCTS",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PRODUCT_APPLICABILITY_UNSPECIFIED" => Some(Self::Unspecified),
"ALL_PRODUCTS" => Some(Self::AllProducts),
"SPECIFIC_PRODUCTS" => Some(Self::SpecificProducts),
_ => None,
}
}
}
/// Store codes or list of store codes the promotion applies to. Only for
/// Local inventory ads promotions.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StoreApplicability {
/// Which store codes the promotion applies to is unknown.
Unspecified = 0,
/// Promotion applies to all stores.
AllStores = 1,
/// Promotion applies to only the specified stores.
SpecificStores = 2,
}
impl StoreApplicability {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
StoreApplicability::Unspecified => "STORE_APPLICABILITY_UNSPECIFIED",
StoreApplicability::AllStores => "ALL_STORES",
StoreApplicability::SpecificStores => "SPECIFIC_STORES",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STORE_APPLICABILITY_UNSPECIFIED" => Some(Self::Unspecified),
"ALL_STORES" => Some(Self::AllStores),
"SPECIFIC_STORES" => Some(Self::SpecificStores),
_ => None,
}
}
}
/// Offer type of a promotion.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OfferType {
/// Unknown offer type.
Unspecified = 0,
/// Offer type without a code.
NoCode = 1,
/// Offer type with a code. Generic redemption code for the promotion is
/// required when `offerType` = `GENERIC_CODE`.
GenericCode = 2,
}
impl OfferType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
OfferType::Unspecified => "OFFER_TYPE_UNSPECIFIED",
OfferType::NoCode => "NO_CODE",
OfferType::GenericCode => "GENERIC_CODE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OFFER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"NO_CODE" => Some(Self::NoCode),
"GENERIC_CODE" => Some(Self::GenericCode),
_ => None,
}
}
}
/// Channel of a promotion.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RedemptionChannel {
/// Indicates that the channel is unspecified.
Unspecified = 0,
/// Indicates that the channel is in store.
/// This is same as `local` channel used for `products`.
InStore = 1,
/// Indicates that the channel is online.
Online = 2,
}
impl RedemptionChannel {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
RedemptionChannel::Unspecified => "REDEMPTION_CHANNEL_UNSPECIFIED",
RedemptionChannel::InStore => "IN_STORE",
RedemptionChannel::Online => "ONLINE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REDEMPTION_CHANNEL_UNSPECIFIED" => Some(Self::Unspecified),
"IN_STORE" => Some(Self::InStore),
"ONLINE" => Some(Self::Online),
_ => None,
}
}
}
/// [Coupon value
/// type](<https://support.google.com/merchants/answer/13861986?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// of a promotion.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CouponValueType {
/// Indicates that the coupon value type is unspecified.
Unspecified = 0,
/// Money off coupon value type.
MoneyOff = 1,
/// Percent off coupon value type.
PercentOff = 2,
/// Buy M quantity, get N money off coupon value type.
/// `minimum_purchase_quantity` and `get_this_quantity_discounted` must be
/// present. `money_off_amount` must also be present.
BuyMGetNMoneyOff = 3,
/// Buy M quantity, get N percent off coupon value type.
/// `minimum_purchase_quantity` and `get_this_quantity_discounted` must be
/// present. `percent_off_percentage` must also be present.
BuyMGetNPercentOff = 4,
/// Buy M quantity, get money off. `minimum_purchase_quantity` and
/// `money_off_amount` must be present.
BuyMGetMoneyOff = 5,
/// Buy M quantity, get money off. `minimum_purchase_quantity` and
/// `percent_off_percentage` must be present.
BuyMGetPercentOff = 6,
/// Free gift with description only.
FreeGift = 7,
/// Free gift with monetary value.
FreeGiftWithValue = 8,
/// Free gift with item ID.
FreeGiftWithItemId = 9,
/// Standard free shipping coupon value type.
FreeShippingStandard = 10,
/// Overnight free shipping coupon value type.
FreeShippingOvernight = 11,
/// Two day free shipping coupon value type.
FreeShippingTwoDay = 12,
}
impl CouponValueType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CouponValueType::Unspecified => "COUPON_VALUE_TYPE_UNSPECIFIED",
CouponValueType::MoneyOff => "MONEY_OFF",
CouponValueType::PercentOff => "PERCENT_OFF",
CouponValueType::BuyMGetNMoneyOff => "BUY_M_GET_N_MONEY_OFF",
CouponValueType::BuyMGetNPercentOff => "BUY_M_GET_N_PERCENT_OFF",
CouponValueType::BuyMGetMoneyOff => "BUY_M_GET_MONEY_OFF",
CouponValueType::BuyMGetPercentOff => "BUY_M_GET_PERCENT_OFF",
CouponValueType::FreeGift => "FREE_GIFT",
CouponValueType::FreeGiftWithValue => "FREE_GIFT_WITH_VALUE",
CouponValueType::FreeGiftWithItemId => "FREE_GIFT_WITH_ITEM_ID",
CouponValueType::FreeShippingStandard => "FREE_SHIPPING_STANDARD",
CouponValueType::FreeShippingOvernight => "FREE_SHIPPING_OVERNIGHT",
CouponValueType::FreeShippingTwoDay => "FREE_SHIPPING_TWO_DAY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"COUPON_VALUE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"MONEY_OFF" => Some(Self::MoneyOff),
"PERCENT_OFF" => Some(Self::PercentOff),
"BUY_M_GET_N_MONEY_OFF" => Some(Self::BuyMGetNMoneyOff),
"BUY_M_GET_N_PERCENT_OFF" => Some(Self::BuyMGetNPercentOff),
"BUY_M_GET_MONEY_OFF" => Some(Self::BuyMGetMoneyOff),
"BUY_M_GET_PERCENT_OFF" => Some(Self::BuyMGetPercentOff),
"FREE_GIFT" => Some(Self::FreeGift),
"FREE_GIFT_WITH_VALUE" => Some(Self::FreeGiftWithValue),
"FREE_GIFT_WITH_ITEM_ID" => Some(Self::FreeGiftWithItemId),
"FREE_SHIPPING_STANDARD" => Some(Self::FreeShippingStandard),
"FREE_SHIPPING_OVERNIGHT" => Some(Self::FreeShippingOvernight),
"FREE_SHIPPING_TWO_DAY" => Some(Self::FreeShippingTwoDay),
_ => None,
}
}
}
/// Represents a promotion. See the following articles for more details.
///
/// Required promotion input attributes to pass data validation checks are
/// primarily defined below:
///
/// * [Promotions data
/// specification](<https://support.google.com/merchants/answer/2906014>)
/// * [Local promotions data
/// specification](<https://support.google.com/merchants/answer/10146130>)
///
/// After inserting, updating a promotion input, it may take several minutes
/// before the final promotion can be retrieved.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Promotion {
/// Identifier. The name of the promotion.
/// Format: `accounts/{account}/promotions/{promotion}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Required. The user provided promotion ID to uniquely identify the
/// promotion. Follow [minimum
/// requirements](<https://support.google.com/merchants/answer/7050148?ref_topic=7322920&sjid=871860036916537104-NC#minimum_requirements>)
/// to prevent promotion disapprovals.
#[prost(string, tag = "2")]
pub promotion_id: ::prost::alloc::string::String,
/// Required. The two-letter [ISO
/// 639-1](<http://en.wikipedia.org/wiki/ISO_639-1>) language code for the
/// promotion.
///
/// Promotions is only for [selected
/// languages](<https://support.google.com/merchants/answer/4588281?ref_topic=6396150&sjid=18314938579342094533-NC#option3&zippy=>).
#[prost(string, tag = "3")]
pub content_language: ::prost::alloc::string::String,
/// Required. The target country used as part of the unique identifier.
/// Represented as a [CLDR territory
/// code](<https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml>).
///
/// Promotions are only available in selected
/// countries, [Free Listings and Shopping
/// ads](<https://support.google.com/merchants/answer/4588460>) [Local Inventory
/// ads](<https://support.google.com/merchants/answer/10146326>)
#[prost(string, tag = "4")]
pub target_country: ::prost::alloc::string::String,
/// Required. [Redemption
/// channel](<https://support.google.com/merchants/answer/13837674?ref_topic=13773355&sjid=17642868584668136159-NC>)
/// for the promotion. At least one channel is required.
#[prost(enumeration = "RedemptionChannel", repeated, packed = "false", tag = "5")]
pub redemption_channel: ::prost::alloc::vec::Vec<i32>,
/// Output only. The primary data source of the promotion.
#[prost(string, tag = "6")]
pub data_source: ::prost::alloc::string::String,
/// Optional. A list of promotion attributes.
#[prost(message, optional, tag = "7")]
pub attributes: ::core::option::Option<Attributes>,
/// Optional. A list of custom (merchant-provided) attributes. It can also be
/// used for submitting any attribute of the data specification in its generic
/// form (for example,
/// `{ "name": "size type", "value": "regular" }`).
/// This is useful for submitting attributes not explicitly exposed by the
/// API.
#[prost(message, repeated, tag = "8")]
pub custom_attributes: ::prost::alloc::vec::Vec<
super::super::super::r#type::CustomAttribute,
>,
/// Output only. The [status of a
/// promotion](<https://support.google.com/merchants/answer/3398326?ref_topic=7322924&sjid=5155774230887277618-NC>),
/// data validation issues, that is, information about a promotion computed
/// asynchronously.
#[prost(message, optional, tag = "9")]
pub promotion_status: ::core::option::Option<PromotionStatus>,
/// Optional. Represents the existing version (freshness) of the promotion,
/// which can be used to preserve the right order when multiple updates are
/// done at the same time.
///
/// If set, the insertion is prevented when version number is lower than
/// the current version number of the existing promotion. Re-insertion (for
/// example, promotion refresh after 30 days) can be performed with the current
/// `version_number`.
///
/// If the operation is prevented, the aborted exception will be
/// thrown.
#[prost(int64, optional, tag = "10")]
pub version_number: ::core::option::Option<i64>,
}
/// Request message for the `InsertPromotion` method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InsertPromotionRequest {
/// Required. The account where the promotion will be inserted.
/// Format: accounts/{account}
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The promotion to insert.
#[prost(message, optional, tag = "2")]
pub promotion: ::core::option::Option<Promotion>,
/// Required. The data source of the
/// [promotion](<https://support.google.com/merchants/answer/6396268?sjid=5155774230887277618-NC>)
/// Format:
/// `accounts/{account}/dataSources/{datasource}`.
#[prost(string, tag = "3")]
pub data_source: ::prost::alloc::string::String,
}
/// Request message for the `GetPromotion` method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPromotionRequest {
/// Required. The name of the promotion to retrieve.
/// Format: `accounts/{account}/promotions/{promotions}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the `ListPromotions` method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPromotionsRequest {
/// Required. The account to list processed promotions for.
/// Format: `accounts/{account}`
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Output only. The maximum number of promotions 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 promotions
/// will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// Output only. A page token, received from a previous `ListPromotions` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListPromotions` must
/// match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response message for the `ListPromotions` method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPromotionsResponse {
/// The processed promotions from the specified account.
#[prost(message, repeated, tag = "1")]
pub promotions: ::prost::alloc::vec::Vec<Promotion>,
/// A token, which can be sent as `page_token` to retrieve the next page.
/// If this field is omitted, there are no subsequent pages.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod promotions_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service to manage promotions for products.
#[derive(Debug, Clone)]
pub struct PromotionsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PromotionsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PromotionsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
PromotionsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Inserts a promotion for your Merchant Center account. If the promotion
/// already exists, then it updates the promotion instead.
pub async fn insert_promotion(
&mut self,
request: impl tonic::IntoRequest<super::InsertPromotionRequest>,
) -> std::result::Result<tonic::Response<super::Promotion>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.shopping.merchant.promotions.v1beta.PromotionsService/InsertPromotion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.shopping.merchant.promotions.v1beta.PromotionsService",
"InsertPromotion",
),
);
self.inner.unary(req, path, codec).await
}
/// Retrieves the promotion from your Merchant Center account.
///
/// After inserting or updating a promotion input, it may take several
/// minutes before the updated promotion can be retrieved.
pub async fn get_promotion(
&mut self,
request: impl tonic::IntoRequest<super::GetPromotionRequest>,
) -> std::result::Result<tonic::Response<super::Promotion>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.shopping.merchant.promotions.v1beta.PromotionsService/GetPromotion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.shopping.merchant.promotions.v1beta.PromotionsService",
"GetPromotion",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists the promotions in your Merchant 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 or updating a promotion, it may take several minutes before
/// the updated processed promotion can be retrieved.
pub async fn list_promotions(
&mut self,
request: impl tonic::IntoRequest<super::ListPromotionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListPromotionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.shopping.merchant.promotions.v1beta.PromotionsService/ListPromotions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.shopping.merchant.promotions.v1beta.PromotionsService",
"ListPromotions",
),
);
self.inner.unary(req, path, codec).await
}
}
}