xref: /aosp_15_r20/external/googleapis/google/ads/googleads/v14/services/label_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/enums/response_content_type.proto";
20import "google/ads/googleads/v14/resources/label.proto";
21import "google/api/annotations.proto";
22import "google/api/client.proto";
23import "google/api/field_behavior.proto";
24import "google/api/resource.proto";
25import "google/protobuf/field_mask.proto";
26import "google/rpc/status.proto";
27
28option csharp_namespace = "Google.Ads.GoogleAds.V14.Services";
29option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v14/services;services";
30option java_multiple_files = true;
31option java_outer_classname = "LabelServiceProto";
32option java_package = "com.google.ads.googleads.v14.services";
33option objc_class_prefix = "GAA";
34option php_namespace = "Google\\Ads\\GoogleAds\\V14\\Services";
35option ruby_package = "Google::Ads::GoogleAds::V14::Services";
36
37// Service to manage labels.
38service LabelService {
39  option (google.api.default_host) = "googleads.googleapis.com";
40  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords";
41
42  // Creates, updates, or removes labels. Operation statuses are returned.
43  //
44  // List of thrown errors:
45  //   [AuthenticationError]()
46  //   [AuthorizationError]()
47  //   [DatabaseError]()
48  //   [DateError]()
49  //   [DistinctError]()
50  //   [FieldError]()
51  //   [FieldMaskError]()
52  //   [HeaderError]()
53  //   [IdError]()
54  //   [InternalError]()
55  //   [LabelError]()
56  //   [MutateError]()
57  //   [NewResourceCreationError]()
58  //   [NotEmptyError]()
59  //   [NullError]()
60  //   [OperatorError]()
61  //   [QuotaError]()
62  //   [RangeError]()
63  //   [RequestError]()
64  //   [ResourceCountLimitExceededError]()
65  //   [SizeLimitError]()
66  //   [StringFormatError]()
67  //   [StringLengthError]()
68  rpc MutateLabels(MutateLabelsRequest) returns (MutateLabelsResponse) {
69    option (google.api.http) = {
70      post: "/v14/customers/{customer_id=*}/labels:mutate"
71      body: "*"
72    };
73    option (google.api.method_signature) = "customer_id,operations";
74  }
75}
76
77// Request message for
78// [LabelService.MutateLabels][google.ads.googleads.v14.services.LabelService.MutateLabels].
79message MutateLabelsRequest {
80  // Required. ID of the customer whose labels are being modified.
81  string customer_id = 1 [(google.api.field_behavior) = REQUIRED];
82
83  // Required. The list of operations to perform on labels.
84  repeated LabelOperation operations = 2
85      [(google.api.field_behavior) = REQUIRED];
86
87  // If true, successful operations will be carried out and invalid
88  // operations will return errors. If false, all operations will be carried
89  // out in one transaction if and only if they are all valid.
90  // Default is false.
91  bool partial_failure = 3;
92
93  // If true, the request is validated but not executed. Only errors are
94  // returned, not results.
95  bool validate_only = 4;
96
97  // The response content type setting. Determines whether the mutable resource
98  // or just the resource name should be returned post mutation.
99  google.ads.googleads.v14.enums.ResponseContentTypeEnum.ResponseContentType
100      response_content_type = 5;
101}
102
103// A single operation (create, remove, update) on a label.
104message LabelOperation {
105  // FieldMask that determines which resource fields are modified in an update.
106  google.protobuf.FieldMask update_mask = 4;
107
108  // The mutate operation.
109  oneof operation {
110    // Create operation: No resource name is expected for the new label.
111    google.ads.googleads.v14.resources.Label create = 1;
112
113    // Update operation: The label is expected to have a valid resource name.
114    google.ads.googleads.v14.resources.Label update = 2;
115
116    // Remove operation: A resource name for the label being removed, in
117    // this format:
118    //
119    // `customers/{customer_id}/labels/{label_id}`
120    string remove = 3 [(google.api.resource_reference) = {
121      type: "googleads.googleapis.com/Label"
122    }];
123  }
124}
125
126// Response message for a labels mutate.
127message MutateLabelsResponse {
128  // Errors that pertain to operation failures in the partial failure mode.
129  // Returned only when partial_failure = true and all errors occur inside the
130  // operations. If any errors occur outside the operations (for example, auth
131  // errors), we return an RPC level error.
132  google.rpc.Status partial_failure_error = 3;
133
134  // All results for the mutate.
135  repeated MutateLabelResult results = 2;
136}
137
138// The result for a label mutate.
139message MutateLabelResult {
140  // Returned for successful operations.
141  string resource_name = 1 [
142    (google.api.resource_reference) = { type: "googleads.googleapis.com/Label" }
143  ];
144
145  // The mutated label with only mutable fields after mutate. The field will
146  // only be returned when response_content_type is set to "MUTABLE_RESOURCE".
147  google.ads.googleads.v14.resources.Label label = 2;
148}
149