Skip to content

Commit c4c5ad7

Browse files
Google APIscopybara-github
authored andcommitted
feat(accounts): Add batch operations for custom regions
Added the following methods to the `RegionsService` in the Merchant API Accounts v1: - `BatchCreateRegions`: Create multiple regions in a single request. - `BatchUpdateRegions`: Update multiple regions in a single request. - `BatchDeleteRegions`: Delete multiple regions in a single request. These methods allow for more efficient management of custom regions. PiperOrigin-RevId: 800519608
1 parent 6914b33 commit c4c5ad7

2 files changed

Lines changed: 94 additions & 1 deletion

File tree

google/shopping/merchant/accounts/v1/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ ruby_cloud_gapic_library(
387387
name = "accounts_ruby_gapic",
388388
srcs = [":accounts_proto_with_info"],
389389
extra_protoc_parameters = [
390-
"ruby-cloud-gem-name=google-shopping-merchant-accounts-v1",
391390
"ruby-cloud-extra-dependencies=google-shopping-type=~>1.0",
391+
"ruby-cloud-gem-name=google-shopping-merchant-accounts-v1",
392392
],
393393
grpc_service_config = "accounts_grpc_service_config.json",
394394
rest_numeric_enums = True,

google/shopping/merchant/accounts/v1/regions.proto

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ service RegionsService {
5959
option (google.api.method_signature) = "parent,region,region_id";
6060
}
6161

62+
// Creates one or more regions in your Merchant Center account.
63+
// Executing this method requires admin access.
64+
rpc BatchCreateRegions(BatchCreateRegionsRequest)
65+
returns (BatchCreateRegionsResponse) {
66+
option (google.api.http) = {
67+
post: "/accounts/v1/{parent=accounts/*}/regions:batchCreate"
68+
body: "*"
69+
};
70+
}
71+
6272
// Updates a region definition in your Merchant Center account.
6373
// Executing this method requires admin access.
6474
rpc UpdateRegion(UpdateRegionRequest) returns (Region) {
@@ -69,6 +79,16 @@ service RegionsService {
6979
option (google.api.method_signature) = "region,update_mask";
7080
}
7181

82+
// Updates one or more regions in your Merchant Center account.
83+
// Executing this method requires admin access.
84+
rpc BatchUpdateRegions(BatchUpdateRegionsRequest)
85+
returns (BatchUpdateRegionsResponse) {
86+
option (google.api.http) = {
87+
post: "/accounts/v1/{parent=accounts/*}/regions:batchUpdate"
88+
body: "*"
89+
};
90+
}
91+
7292
// Deletes a region definition from your Merchant Center account. Executing
7393
// this method requires admin access.
7494
rpc DeleteRegion(DeleteRegionRequest) returns (google.protobuf.Empty) {
@@ -78,6 +98,16 @@ service RegionsService {
7898
option (google.api.method_signature) = "name";
7999
}
80100

101+
// Deletes multiple regions by name from your Merchant Center account.
102+
// Executing this method requires admin access.
103+
rpc BatchDeleteRegions(BatchDeleteRegionsRequest)
104+
returns (google.protobuf.Empty) {
105+
option (google.api.http) = {
106+
post: "/accounts/v1/{parent=accounts/*}/regions:batchDelete"
107+
body: "*"
108+
};
109+
}
110+
81111
// Lists the regions in your Merchant Center account.
82112
rpc ListRegions(ListRegionsRequest) returns (ListRegionsResponse) {
83113
option (google.api.http) = {
@@ -118,6 +148,29 @@ message CreateRegionRequest {
118148
Region region = 3 [(google.api.field_behavior) = REQUIRED];
119149
}
120150

151+
// Request message for the `BatchCreateRegions` method.
152+
message BatchCreateRegionsRequest {
153+
// Required. The account to create one or more regions for.
154+
// Format: `accounts/{account}`
155+
string parent = 1 [
156+
(google.api.field_behavior) = REQUIRED,
157+
(google.api.resource_reference) = {
158+
type: "merchantapi.googleapis.com/Account"
159+
}
160+
];
161+
162+
// Required. The region(s) to create.
163+
// The maximum number of regions that can be created in a batch is 100.
164+
repeated CreateRegionRequest requests = 2
165+
[(google.api.field_behavior) = REQUIRED];
166+
}
167+
168+
// Response message for the `BatchCreateRegions` method.
169+
message BatchCreateRegionsResponse {
170+
// The created region(s).
171+
repeated Region regions = 1;
172+
}
173+
121174
// Request message for the `UpdateRegion` method.
122175
message UpdateRegionRequest {
123176
// Required. The updated region.
@@ -130,6 +183,29 @@ message UpdateRegionRequest {
130183
[(google.api.field_behavior) = OPTIONAL];
131184
}
132185

186+
// Request message for the `BatchUpdateRegions` method.
187+
message BatchUpdateRegionsRequest {
188+
// Required. The account to update one or more regions for.
189+
// Format: `accounts/{account}`
190+
string parent = 1 [
191+
(google.api.field_behavior) = REQUIRED,
192+
(google.api.resource_reference) = {
193+
type: "merchantapi.googleapis.com/Account"
194+
}
195+
];
196+
197+
// Required. The region(s) to update.
198+
// The maximum number of regions that can be updated in a batch is 100.
199+
repeated UpdateRegionRequest requests = 2
200+
[(google.api.field_behavior) = REQUIRED];
201+
}
202+
203+
// Response message for the `BatchUpdateRegions` method.
204+
message BatchUpdateRegionsResponse {
205+
// The updated region(s).
206+
repeated Region regions = 1;
207+
}
208+
133209
// Request message for the `DeleteRegion` method.
134210
message DeleteRegionRequest {
135211
// Required. The name of the region to delete.
@@ -142,6 +218,23 @@ message DeleteRegionRequest {
142218
];
143219
}
144220

221+
// Request message for the `BatchDeleteRegions` method.
222+
message BatchDeleteRegionsRequest {
223+
// Required. The account to delete one or more regions from.
224+
// Format: `accounts/{account}`
225+
string parent = 1 [
226+
(google.api.field_behavior) = REQUIRED,
227+
(google.api.resource_reference) = {
228+
type: "merchantapi.googleapis.com/Account"
229+
}
230+
];
231+
232+
// Required. The names of the regions to delete.
233+
// A maximum of 100 regions can be deleted in a batch.
234+
repeated DeleteRegionRequest requests = 2
235+
[(google.api.field_behavior) = REQUIRED];
236+
}
237+
145238
// Request message for the `ListRegions` method.
146239
message ListRegionsRequest {
147240
// Required. The account to list regions for.

0 commit comments

Comments
 (0)