xref: /aosp_15_r20/external/googleapis/google/ads/googleads/v14/services/ad_service.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.v14.services;
18
19import "google/ads/googleads/v14/common/policy.proto";
20import "google/ads/googleads/v14/enums/response_content_type.proto";
21import "google/ads/googleads/v14/resources/ad.proto";
22import "google/api/annotations.proto";
23import "google/api/client.proto";
24import "google/api/field_behavior.proto";
25import "google/api/resource.proto";
26import "google/protobuf/field_mask.proto";
27import "google/rpc/status.proto";
28
29option csharp_namespace = "Google.Ads.GoogleAds.V14.Services";
30option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v14/services;services";
31option java_multiple_files = true;
32option java_outer_classname = "AdServiceProto";
33option java_package = "com.google.ads.googleads.v14.services";
34option objc_class_prefix = "GAA";
35option php_namespace = "Google\\Ads\\GoogleAds\\V14\\Services";
36option ruby_package = "Google::Ads::GoogleAds::V14::Services";
37
38// Proto file describing the  Ad service.
39
40// Service to manage ads.
41service AdService {
42  option (google.api.default_host) = "googleads.googleapis.com";
43  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords";
44
45  // Returns the requested ad in full detail.
46  //
47  // List of thrown errors:
48  //   [AuthenticationError]()
49  //   [AuthorizationError]()
50  //   [HeaderError]()
51  //   [InternalError]()
52  //   [QuotaError]()
53  //   [RequestError]()
54  rpc GetAd(GetAdRequest) returns (google.ads.googleads.v14.resources.Ad) {
55    option (google.api.http) = {
56      get: "/v14/{resource_name=customers/*/ads/*}"
57    };
58    option (google.api.method_signature) = "resource_name";
59  }
60
61  // Updates ads. Operation statuses are returned. Updating ads is not supported
62  // for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd.
63  //
64  // List of thrown errors:
65  //   [AdCustomizerError]()
66  //   [AdError]()
67  //   [AdSharingError]()
68  //   [AdxError]()
69  //   [AssetError]()
70  //   [AssetLinkError]()
71  //   [AuthenticationError]()
72  //   [AuthorizationError]()
73  //   [CollectionSizeError]()
74  //   [DatabaseError]()
75  //   [DateError]()
76  //   [DistinctError]()
77  //   [FeedAttributeReferenceError]()
78  //   [FieldError]()
79  //   [FieldMaskError]()
80  //   [FunctionError]()
81  //   [FunctionParsingError]()
82  //   [HeaderError]()
83  //   [IdError]()
84  //   [ImageError]()
85  //   [InternalError]()
86  //   [ListOperationError]()
87  //   [MediaBundleError]()
88  //   [MediaFileError]()
89  //   [MutateError]()
90  //   [NewResourceCreationError]()
91  //   [NotEmptyError]()
92  //   [NullError]()
93  //   [OperatorError]()
94  //   [PolicyFindingError]()
95  //   [PolicyViolationError]()
96  //   [QuotaError]()
97  //   [RangeError]()
98  //   [RequestError]()
99  //   [SizeLimitError]()
100  //   [StringFormatError]()
101  //   [StringLengthError]()
102  //   [UrlFieldError]()
103  rpc MutateAds(MutateAdsRequest) returns (MutateAdsResponse) {
104    option (google.api.http) = {
105      post: "/v14/customers/{customer_id=*}/ads:mutate"
106      body: "*"
107    };
108    option (google.api.method_signature) = "customer_id,operations";
109  }
110}
111
112// Request message for
113// [AdService.GetAd][google.ads.googleads.v14.services.AdService.GetAd].
114message GetAdRequest {
115  // Required. The resource name of the ad to fetch.
116  string resource_name = 1 [
117    (google.api.field_behavior) = REQUIRED,
118    (google.api.resource_reference) = { type: "googleads.googleapis.com/Ad" }
119  ];
120}
121
122// Request message for
123// [AdService.MutateAds][google.ads.googleads.v14.services.AdService.MutateAds].
124message MutateAdsRequest {
125  // Required. The ID of the customer whose ads are being modified.
126  string customer_id = 1 [(google.api.field_behavior) = REQUIRED];
127
128  // Required. The list of operations to perform on individual ads.
129  repeated AdOperation operations = 2 [(google.api.field_behavior) = REQUIRED];
130
131  // If true, successful operations will be carried out and invalid
132  // operations will return errors. If false, all operations will be carried
133  // out in one transaction if and only if they are all valid.
134  // Default is false.
135  bool partial_failure = 4;
136
137  // The response content type setting. Determines whether the mutable resource
138  // or just the resource name should be returned post mutation.
139  google.ads.googleads.v14.enums.ResponseContentTypeEnum.ResponseContentType
140      response_content_type = 5;
141
142  // If true, the request is validated but not executed. Only errors are
143  // returned, not results.
144  bool validate_only = 3;
145}
146
147// A single update operation on an ad.
148message AdOperation {
149  // FieldMask that determines which resource fields are modified in an update.
150  google.protobuf.FieldMask update_mask = 2;
151
152  // Configuration for how policies are validated.
153  google.ads.googleads.v14.common.PolicyValidationParameter
154      policy_validation_parameter = 3;
155
156  // The mutate operation.
157  oneof operation {
158    // Update operation: The ad is expected to have a valid resource name
159    // in this format:
160    //
161    // `customers/{customer_id}/ads/{ad_id}`
162    google.ads.googleads.v14.resources.Ad update = 1;
163  }
164}
165
166// Response message for an ad mutate.
167message MutateAdsResponse {
168  // Errors that pertain to operation failures in the partial failure mode.
169  // Returned only when partial_failure = true and all errors occur inside the
170  // operations. If any errors occur outside the operations (for example, auth
171  // errors), we return an RPC level error.
172  google.rpc.Status partial_failure_error = 3;
173
174  // All results for the mutate.
175  repeated MutateAdResult results = 2;
176}
177
178// The result for the ad mutate.
179message MutateAdResult {
180  // The resource name returned for successful operations.
181  string resource_name = 1 [
182    (google.api.resource_reference) = { type: "googleads.googleapis.com/Ad" }
183  ];
184
185  // The mutated ad with only mutable fields after mutate. The field will only
186  // be returned when response_content_type is set to "MUTABLE_RESOURCE".
187  google.ads.googleads.v14.resources.Ad ad = 2;
188}
189