Skip to content

Commit 3568ce2

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add the AccountLimit resource and its service to the quota bundle
PiperOrigin-RevId: 830811341
1 parent d1450ae commit 3568ce2

File tree

5 files changed

+168
-13
lines changed

5 files changed

+168
-13
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ load("@rules_proto//proto:defs.bzl", "proto_library")
2424
proto_library(
2525
name = "quota_proto",
2626
srcs = [
27+
"accountlimits.proto",
2728
"quota.proto",
2829
],
2930
deps = [
@@ -86,6 +87,8 @@ java_gapic_library(
8687
java_gapic_test(
8788
name = "quota_java_gapic_test_suite",
8889
test_classes = [
90+
"com.google.shopping.merchant.quota.v1.AccountLimitsServiceClientHttpJsonTest",
91+
"com.google.shopping.merchant.quota.v1.AccountLimitsServiceClientTest",
8992
"com.google.shopping.merchant.quota.v1.QuotaServiceClientHttpJsonTest",
9093
"com.google.shopping.merchant.quota.v1.QuotaServiceClientTest",
9194
],
@@ -290,9 +293,7 @@ ruby_grpc_library(
290293
ruby_cloud_gapic_library(
291294
name = "quota_ruby_gapic",
292295
srcs = [":quota_proto_with_info"],
293-
extra_protoc_parameters = [
294-
"ruby-cloud-gem-name=google-shopping-merchant-quota-v1", # fixed manually
295-
],
296+
extra_protoc_parameters = ["ruby-cloud-gem-name=google-shopping-merchant-quota-v1"],
296297
grpc_service_config = "quota_grpc_service_config.json",
297298
rest_numeric_enums = True,
298299
service_yaml = "merchantapi_v1.yaml",
@@ -327,7 +328,6 @@ load(
327328

328329
csharp_proto_library(
329330
name = "quota_csharp_proto",
330-
extra_opts = [],
331331
deps = [":quota_proto"],
332332
)
333333

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
// Copyright 2025 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+
15+
syntax = "proto3";
16+
17+
package google.shopping.merchant.quota.v1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
23+
24+
option csharp_namespace = "Google.Shopping.Merchant.Quota.V1";
25+
option go_package = "cloud.google.com/go/shopping/merchant/quota/apiv1/quotapb;quotapb";
26+
option java_multiple_files = true;
27+
option java_outer_classname = "AccountLimitsProto";
28+
option java_package = "com.google.shopping.merchant.quota.v1";
29+
option php_namespace = "Google\\Shopping\\Merchant\\Quota\\V1";
30+
option ruby_package = "Google::Shopping::Merchant::Quota::V1";
31+
32+
// Service to retrieve account limits.
33+
service AccountLimitsService {
34+
option (google.api.default_host) = "merchantapi.googleapis.com";
35+
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";
36+
37+
// Retrieves an account limit.
38+
rpc GetAccountLimit(GetAccountLimitRequest) returns (AccountLimit) {
39+
option (google.api.http) = {
40+
get: "/accounts/v1/{name=accounts/*/limits/*}"
41+
};
42+
option (google.api.method_signature) = "name";
43+
}
44+
45+
// Lists the limits of an account.
46+
rpc ListAccountLimits(ListAccountLimitsRequest)
47+
returns (ListAccountLimitsResponse) {
48+
option (google.api.http) = {
49+
get: "/accounts/v1/{parent=accounts/*}/limits"
50+
};
51+
option (google.api.method_signature) = "parent";
52+
}
53+
}
54+
55+
// The limit for products.
56+
message ProductLimit {
57+
// The scope of the limit.
58+
enum Scope {
59+
// Default value. Should not be used.
60+
SCOPE_UNSPECIFIED = 0;
61+
62+
// Limit for products in non-EEA countries.
63+
ADS_NON_EEA = 1;
64+
65+
// Limit for products in EEA countries.
66+
ADS_EEA = 2;
67+
}
68+
69+
// Required. The scope of the product limit.
70+
Scope scope = 1 [(google.api.field_behavior) = REQUIRED];
71+
72+
// Required. The maximum number of products that are allowed in the account in
73+
// the given scope.
74+
int64 limit = 2 [(google.api.field_behavior) = REQUIRED];
75+
}
76+
77+
// A limit of a certain type that is applied to an account.
78+
message AccountLimit {
79+
option (google.api.resource) = {
80+
type: "merchantapi.googleapis.com/AccountLimit"
81+
pattern: "accounts/{account}/limits/{limit}"
82+
plural: "accountLimits"
83+
singular: "accountLimit"
84+
};
85+
86+
// The type of the limit.
87+
oneof type {
88+
// The limit for products.
89+
ProductLimit products = 100;
90+
}
91+
92+
// Identifier. The limit part of the name will be a combination of the type
93+
// and the scope. For example: `accounts/123/limits/products~ADS_NON_EEA`
94+
//
95+
// Format: `accounts/{account}/limits/{limit}`
96+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
97+
}
98+
99+
// Request message for the `GetAccountLimit` method.
100+
message GetAccountLimitRequest {
101+
// Required. The name of the limit to retrieve.
102+
// Format: `accounts/{account}/limits/{limit}`
103+
// For example: `accounts/123/limits/products~ADS_NON_EEA`
104+
string name = 1 [
105+
(google.api.field_behavior) = REQUIRED,
106+
(google.api.resource_reference) = {
107+
type: "merchantapi.googleapis.com/AccountLimit"
108+
}
109+
];
110+
}
111+
112+
// Request message for the `ListAccountLimits` method.
113+
message ListAccountLimitsRequest {
114+
// Required. The parent account.
115+
// Format: `accounts/{account}`
116+
string parent = 1 [
117+
(google.api.field_behavior) = REQUIRED,
118+
(google.api.resource_reference) = {
119+
type: "merchantapi.googleapis.com/Account"
120+
}
121+
];
122+
123+
// Optional. The maximum number of limits to return. The service may return
124+
// fewer than this value. If unspecified, at most 100 limits will be returned.
125+
// The maximum value is 100; values above 100 will be coerced to 100.
126+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
127+
128+
// Optional. A page token, received from a previous `ListAccountLimits` call.
129+
// Provide this to retrieve the subsequent page.
130+
//
131+
// When paginating, all other parameters provided to `ListAccountLimits` must
132+
// match the call that provided the page token.
133+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
134+
135+
// Required. A filter on the limit `type` is required, for example, `type =
136+
// "products"`.
137+
string filter = 4 [(google.api.field_behavior) = REQUIRED];
138+
}
139+
140+
// Response message for the `ListAccountLimits` method.
141+
message ListAccountLimitsResponse {
142+
// The limits for the given account.
143+
repeated AccountLimit account_limits = 1;
144+
145+
// A token, which can be sent as `page_token` to retrieve the next page.
146+
// If this field is omitted, there are no subsequent pages.
147+
string next_page_token = 2;
148+
}

google/shopping/merchant/quota/v1/merchantapi_v1.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: merchantapi.googleapis.com
44
title: Merchant API
55

66
apis:
7+
- name: google.shopping.merchant.quota.v1.AccountLimitsService
78
- name: google.shopping.merchant.quota.v1.QuotaService
89

910
documentation:
@@ -27,6 +28,14 @@ documentation:
2728
2829
authentication:
2930
rules:
31+
- selector: google.shopping.merchant.quota.v1.AccountLimitsService.GetAccountLimit
32+
oauth:
33+
canonical_scopes: |-
34+
https://www.googleapis.com/auth/content
35+
- selector: google.shopping.merchant.quota.v1.AccountLimitsService.ListAccountLimits
36+
oauth:
37+
canonical_scopes: |-
38+
https://www.googleapis.com/auth/content
3039
- selector: google.shopping.merchant.quota.v1.QuotaService.ListQuotaGroups
3140
oauth:
3241
canonical_scopes: |-

google/shopping/merchant/quota/v1/quota_grpc_service_config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"methodConfig": [{
33
"name": [
4-
{ "service": "google.shopping.merchant.quota.v1.QuotaService" }
4+
{ "service": "google.shopping.merchant.quota.v1.QuotaService" },
5+
{ "service": "google.shopping.merchant.quota.v1.AccountLimitsService" }
56
],
67
"timeout": "60s",
78
"retryPolicy": {

google/shopping/merchant/quota/v1beta/BUILD.bazel

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ py_gapic_library(
167167
name = "quota_py_gapic",
168168
srcs = [":quota_proto"],
169169
grpc_service_config = "quota_grpc_service_config.json",
170+
opt_args = [
171+
"python-gapic-namespace=google.shopping",
172+
"python-gapic-name=merchant_quota",
173+
],
170174
rest_numeric_enums = True,
171175
service_yaml = "merchantapi_v1beta.yaml",
172176
transport = "grpc+rest",
173177
deps = [
174178
],
175-
opt_args = [
176-
"python-gapic-namespace=google.shopping",
177-
"python-gapic-name=merchant_quota",
178-
],
179179
)
180180

181181
py_test(
@@ -291,9 +291,7 @@ ruby_grpc_library(
291291
ruby_cloud_gapic_library(
292292
name = "quota_ruby_gapic",
293293
srcs = [":quota_proto_with_info"],
294-
extra_protoc_parameters = [
295-
"ruby-cloud-gem-name=google-shopping-merchant-quota-v1beta",
296-
],
294+
extra_protoc_parameters = ["ruby-cloud-gem-name=google-shopping-merchant-quota-v1beta"],
297295
grpc_service_config = "quota_grpc_service_config.json",
298296
rest_numeric_enums = True,
299297
service_yaml = "merchantapi_v1beta.yaml",
@@ -328,7 +326,6 @@ load(
328326

329327
csharp_proto_library(
330328
name = "quota_csharp_proto",
331-
extra_opts = [],
332329
deps = [":quota_proto"],
333330
)
334331

0 commit comments

Comments
 (0)