xref: /aosp_15_r20/external/googleapis/google/ads/googleads/v16/common/matching_function.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.ads.googleads.v16.common;
18
19import "google/ads/googleads/v16/enums/matching_function_context_type.proto";
20import "google/ads/googleads/v16/enums/matching_function_operator.proto";
21
22option csharp_namespace = "Google.Ads.GoogleAds.V16.Common";
23option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v16/common;common";
24option java_multiple_files = true;
25option java_outer_classname = "MatchingFunctionProto";
26option java_package = "com.google.ads.googleads.v16.common";
27option objc_class_prefix = "GAA";
28option php_namespace = "Google\\Ads\\GoogleAds\\V16\\Common";
29option ruby_package = "Google::Ads::GoogleAds::V16::Common";
30
31// Proto file describing a matching function.
32
33// Matching function associated with a
34// CustomerFeed, CampaignFeed, or AdGroupFeed. The matching function is used
35// to filter the set of feed items selected.
36message MatchingFunction {
37  // String representation of the Function.
38  //
39  // Examples:
40  //
41  // 1. IDENTITY(true) or IDENTITY(false). All or no feed items served.
42  // 2. EQUALS(CONTEXT.DEVICE,"Mobile")
43  // 3. IN(FEED_ITEM_ID,{1000001,1000002,1000003})
44  // 4. CONTAINS_ANY(FeedAttribute[12345678,0],{"Mars cruise","Venus cruise"})
45  // 5. AND(IN(FEED_ITEM_ID,{10001,10002}),EQUALS(CONTEXT.DEVICE,"Mobile"))
46  //
47  // For more details, visit
48  // https://developers.google.com/google-ads/api/docs/extensions/feeds/matching-functions
49  //
50  // Note that because multiple strings may represent the same underlying
51  // function (whitespace and single versus double quotation marks, for
52  // example), the value returned may not be identical to the string sent in a
53  // mutate request.
54  optional string function_string = 5;
55
56  // Operator for a function.
57  google.ads.googleads.v16.enums.MatchingFunctionOperatorEnum
58      .MatchingFunctionOperator
59      operator = 4;
60
61  // The operands on the left hand side of the equation. This is also the
62  // operand to be used for single operand expressions such as NOT.
63  repeated Operand left_operands = 2;
64
65  // The operands on the right hand side of the equation.
66  repeated Operand right_operands = 3;
67}
68
69// An operand in a matching function.
70message Operand {
71  // A constant operand in a matching function.
72  message ConstantOperand {
73    // Constant operand values. Required.
74    oneof constant_operand_value {
75      // String value of the operand if it is a string type.
76      string string_value = 5;
77
78      // Int64 value of the operand if it is a int64 type.
79      int64 long_value = 6;
80
81      // Boolean value of the operand if it is a boolean type.
82      bool boolean_value = 7;
83
84      // Double value of the operand if it is a double type.
85      double double_value = 8;
86    }
87  }
88
89  // A feed attribute operand in a matching function.
90  // Used to represent a feed attribute in feed.
91  message FeedAttributeOperand {
92    // The associated feed. Required.
93    optional int64 feed_id = 3;
94
95    // Id of the referenced feed attribute. Required.
96    optional int64 feed_attribute_id = 4;
97  }
98
99  // A function operand in a matching function.
100  // Used to represent nested functions.
101  message FunctionOperand {
102    // The matching function held in this operand.
103    MatchingFunction matching_function = 1;
104  }
105
106  // An operand in a function referring to a value in the request context.
107  message RequestContextOperand {
108    // Type of value to be referred in the request context.
109    google.ads.googleads.v16.enums.MatchingFunctionContextTypeEnum
110        .MatchingFunctionContextType context_type = 1;
111  }
112
113  // Different operands that can be used in a matching function. Required.
114  oneof function_argument_operand {
115    // A constant operand in a matching function.
116    ConstantOperand constant_operand = 1;
117
118    // This operand specifies a feed attribute in feed.
119    FeedAttributeOperand feed_attribute_operand = 2;
120
121    // A function operand in a matching function.
122    // Used to represent nested functions.
123    FunctionOperand function_operand = 3;
124
125    // An operand in a function referring to a value in the request context.
126    RequestContextOperand request_context_operand = 4;
127  }
128}
129