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/enums/response_content_type.proto"; 20import "google/ads/googleads/v14/resources/batch_job.proto"; 21import "google/ads/googleads/v14/services/google_ads_service.proto"; 22import "google/api/annotations.proto"; 23import "google/api/client.proto"; 24import "google/api/field_behavior.proto"; 25import "google/api/resource.proto"; 26import "google/longrunning/operations.proto"; 27import "google/protobuf/empty.proto"; 28import "google/rpc/status.proto"; 29 30option csharp_namespace = "Google.Ads.GoogleAds.V14.Services"; 31option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v14/services;services"; 32option java_multiple_files = true; 33option java_outer_classname = "BatchJobServiceProto"; 34option java_package = "com.google.ads.googleads.v14.services"; 35option objc_class_prefix = "GAA"; 36option php_namespace = "Google\\Ads\\GoogleAds\\V14\\Services"; 37option ruby_package = "Google::Ads::GoogleAds::V14::Services"; 38 39// Proto file describing the BatchJobService. 40 41// Service to manage batch jobs. 42service BatchJobService { 43 option (google.api.default_host) = "googleads.googleapis.com"; 44 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords"; 45 46 // Mutates a batch job. 47 // 48 // List of thrown errors: 49 // [AuthenticationError]() 50 // [AuthorizationError]() 51 // [HeaderError]() 52 // [InternalError]() 53 // [QuotaError]() 54 // [RequestError]() 55 // [ResourceCountLimitExceededError]() 56 rpc MutateBatchJob(MutateBatchJobRequest) returns (MutateBatchJobResponse) { 57 option (google.api.http) = { 58 post: "/v14/customers/{customer_id=*}/batchJobs:mutate" 59 body: "*" 60 }; 61 option (google.api.method_signature) = "customer_id,operation"; 62 } 63 64 // Returns the results of the batch job. The job must be done. 65 // Supports standard list paging. 66 // 67 // List of thrown errors: 68 // [AuthenticationError]() 69 // [AuthorizationError]() 70 // [BatchJobError]() 71 // [HeaderError]() 72 // [InternalError]() 73 // [QuotaError]() 74 // [RequestError]() 75 rpc ListBatchJobResults(ListBatchJobResultsRequest) 76 returns (ListBatchJobResultsResponse) { 77 option (google.api.http) = { 78 get: "/v14/{resource_name=customers/*/batchJobs/*}:listResults" 79 }; 80 option (google.api.method_signature) = "resource_name"; 81 } 82 83 // Runs the batch job. 84 // 85 // The Operation.metadata field type is BatchJobMetadata. When finished, the 86 // long running operation will not contain errors or a response. Instead, use 87 // ListBatchJobResults to get the results of the job. 88 // 89 // List of thrown errors: 90 // [AuthenticationError]() 91 // [AuthorizationError]() 92 // [BatchJobError]() 93 // [HeaderError]() 94 // [InternalError]() 95 // [QuotaError]() 96 // [RequestError]() 97 rpc RunBatchJob(RunBatchJobRequest) returns (google.longrunning.Operation) { 98 option (google.api.http) = { 99 post: "/v14/{resource_name=customers/*/batchJobs/*}:run" 100 body: "*" 101 }; 102 option (google.api.method_signature) = "resource_name"; 103 option (google.longrunning.operation_info) = { 104 response_type: "google.protobuf.Empty" 105 metadata_type: "google.ads.googleads.v14.resources.BatchJob.BatchJobMetadata" 106 }; 107 } 108 109 // Add operations to the batch job. 110 // 111 // List of thrown errors: 112 // [AuthenticationError]() 113 // [AuthorizationError]() 114 // [BatchJobError]() 115 // [HeaderError]() 116 // [InternalError]() 117 // [QuotaError]() 118 // [RequestError]() 119 // [ResourceCountLimitExceededError]() 120 rpc AddBatchJobOperations(AddBatchJobOperationsRequest) 121 returns (AddBatchJobOperationsResponse) { 122 option (google.api.http) = { 123 post: "/v14/{resource_name=customers/*/batchJobs/*}:addOperations" 124 body: "*" 125 }; 126 option (google.api.method_signature) = 127 "resource_name,sequence_token,mutate_operations"; 128 option (google.api.method_signature) = "resource_name,mutate_operations"; 129 } 130} 131 132// Request message for 133// [BatchJobService.MutateBatchJob][google.ads.googleads.v14.services.BatchJobService.MutateBatchJob]. 134message MutateBatchJobRequest { 135 // Required. The ID of the customer for which to create a batch job. 136 string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; 137 138 // Required. The operation to perform on an individual batch job. 139 BatchJobOperation operation = 2 [(google.api.field_behavior) = REQUIRED]; 140} 141 142// A single operation on a batch job. 143message BatchJobOperation { 144 // The mutate operation. 145 oneof operation { 146 // Create operation: No resource name is expected for the new batch job. 147 google.ads.googleads.v14.resources.BatchJob create = 1; 148 149 // Remove operation: The batch job must not have been run. A resource name 150 // for the removed batch job is expected, in this format: 151 // 152 // `customers/{customer_id}/batchJobs/{batch_job_id}` 153 string remove = 4 [(google.api.resource_reference) = { 154 type: "googleads.googleapis.com/BatchJob" 155 }]; 156 } 157} 158 159// Response message for 160// [BatchJobService.MutateBatchJob][google.ads.googleads.v14.services.BatchJobService.MutateBatchJob]. 161message MutateBatchJobResponse { 162 // The result for the mutate. 163 MutateBatchJobResult result = 1; 164} 165 166// The result for the batch job mutate. 167message MutateBatchJobResult { 168 // The resource name of the batch job. 169 string resource_name = 1 [(google.api.resource_reference) = { 170 type: "googleads.googleapis.com/BatchJob" 171 }]; 172} 173 174// Request message for 175// [BatchJobService.RunBatchJob][google.ads.googleads.v14.services.BatchJobService.RunBatchJob]. 176message RunBatchJobRequest { 177 // Required. The resource name of the BatchJob to run. 178 string resource_name = 1 [ 179 (google.api.field_behavior) = REQUIRED, 180 (google.api.resource_reference) = { 181 type: "googleads.googleapis.com/BatchJob" 182 } 183 ]; 184} 185 186// Request message for 187// [BatchJobService.AddBatchJobOperations][google.ads.googleads.v14.services.BatchJobService.AddBatchJobOperations]. 188message AddBatchJobOperationsRequest { 189 // Required. The resource name of the batch job. 190 string resource_name = 1 [ 191 (google.api.field_behavior) = REQUIRED, 192 (google.api.resource_reference) = { 193 type: "googleads.googleapis.com/BatchJob" 194 } 195 ]; 196 197 // A token used to enforce sequencing. 198 // 199 // The first AddBatchJobOperations request for a batch job should not set 200 // sequence_token. Subsequent requests must set sequence_token to the value of 201 // next_sequence_token received in the previous AddBatchJobOperations 202 // response. 203 string sequence_token = 2; 204 205 // Required. The list of mutates being added. 206 // 207 // Operations can use negative integers as temp ids to signify dependencies 208 // between entities created in this batch job. For example, a customer with 209 // id = 1234 can create a campaign and an ad group in that same campaign by 210 // creating a campaign in the first operation with the resource name 211 // explicitly set to "customers/1234/campaigns/-1", and creating an ad group 212 // in the second operation with the campaign field also set to 213 // "customers/1234/campaigns/-1". 214 repeated MutateOperation mutate_operations = 3 215 [(google.api.field_behavior) = REQUIRED]; 216} 217 218// Response message for 219// [BatchJobService.AddBatchJobOperations][google.ads.googleads.v14.services.BatchJobService.AddBatchJobOperations]. 220message AddBatchJobOperationsResponse { 221 // The total number of operations added so far for this batch job. 222 int64 total_operations = 1; 223 224 // The sequence token to be used when calling AddBatchJobOperations again if 225 // more operations need to be added. The next AddBatchJobOperations request 226 // must set the sequence_token field to the value of this field. 227 string next_sequence_token = 2; 228} 229 230// Request message for 231// [BatchJobService.ListBatchJobResults][google.ads.googleads.v14.services.BatchJobService.ListBatchJobResults]. 232message ListBatchJobResultsRequest { 233 // Required. The resource name of the batch job whose results are being 234 // listed. 235 string resource_name = 1 [ 236 (google.api.field_behavior) = REQUIRED, 237 (google.api.resource_reference) = { 238 type: "googleads.googleapis.com/BatchJob" 239 } 240 ]; 241 242 // Token of the page to retrieve. If not specified, the first 243 // page of results will be returned. Use the value obtained from 244 // `next_page_token` in the previous response in order to request 245 // the next page of results. 246 string page_token = 2; 247 248 // Number of elements to retrieve in a single page. 249 // When a page request is too large, the server may decide to 250 // further limit the number of returned resources. 251 int32 page_size = 3; 252 253 // The response content type setting. Determines whether the mutable resource 254 // or just the resource name should be returned. 255 google.ads.googleads.v14.enums.ResponseContentTypeEnum.ResponseContentType 256 response_content_type = 4; 257} 258 259// Response message for 260// [BatchJobService.ListBatchJobResults][google.ads.googleads.v14.services.BatchJobService.ListBatchJobResults]. 261message ListBatchJobResultsResponse { 262 // The list of rows that matched the query. 263 repeated BatchJobResult results = 1; 264 265 // Pagination token used to retrieve the next page of results. 266 // Pass the content of this string as the `page_token` attribute of 267 // the next request. `next_page_token` is not returned for the last 268 // page. 269 string next_page_token = 2; 270} 271 272// An individual batch job result. 273message BatchJobResult { 274 // Index of the mutate operation. 275 int64 operation_index = 1; 276 277 // Response for the mutate. 278 // May be empty if errors occurred. 279 MutateOperationResponse mutate_operation_response = 2; 280 281 // Details of the errors when processing the operation. 282 google.rpc.Status status = 3; 283} 284