• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.shopping.css.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/protobuf/empty.proto";
24
25option csharp_namespace = "Google.Shopping.Css.V1";
26option go_package = "cloud.google.com/go/shopping/css/apiv1/csspb;csspb";
27option java_multiple_files = true;
28option java_outer_classname = "AccountsLabelsProto";
29option java_package = "com.google.shopping.css.v1";
30option php_namespace = "Google\\Shopping\\Css\\V1";
31option ruby_package = "Google::Shopping::Css::V1";
32
33// Manages Merchant Center and CSS accounts labels.
34service AccountLabelsService {
35  option (google.api.default_host) = "css.googleapis.com";
36  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";
37
38  // Lists the labels assigned to an account.
39  rpc ListAccountLabels(ListAccountLabelsRequest)
40      returns (ListAccountLabelsResponse) {
41    option (google.api.http) = {
42      get: "/v1/{parent=accounts/*}/labels"
43    };
44    option (google.api.method_signature) = "parent";
45  }
46
47  // Creates a new label, not assigned to any account.
48  rpc CreateAccountLabel(CreateAccountLabelRequest) returns (AccountLabel) {
49    option (google.api.http) = {
50      post: "/v1/{parent=accounts/*}/labels"
51      body: "account_label"
52    };
53    option (google.api.method_signature) = "parent,account_label";
54  }
55
56  // Updates a label.
57  rpc UpdateAccountLabel(UpdateAccountLabelRequest) returns (AccountLabel) {
58    option (google.api.http) = {
59      patch: "/v1/{account_label.name=accounts/*/labels/*}"
60      body: "account_label"
61    };
62    option (google.api.method_signature) = "account_label";
63  }
64
65  // Deletes a label and removes it from all accounts to which it was assigned.
66  rpc DeleteAccountLabel(DeleteAccountLabelRequest)
67      returns (google.protobuf.Empty) {
68    option (google.api.http) = {
69      delete: "/v1/{name=accounts/*/labels/*}"
70    };
71    option (google.api.method_signature) = "name";
72  }
73}
74
75// Label assigned by CSS domain or CSS group to one of its sub-accounts.
76message AccountLabel {
77  option (google.api.resource) = {
78    type: "css.googleapis.com/AccountLabel"
79    pattern: "accounts/{account}/labels/{label}"
80    plural: "accountLabels"
81    singular: "accountLabel"
82  };
83
84  // The label type.
85  enum LabelType {
86    // Unknown label type.
87    LABEL_TYPE_UNSPECIFIED = 0;
88
89    // Indicates that the label was created manually.
90    MANUAL = 1;
91
92    // Indicates that the label was created automatically by CSS Center.
93    AUTOMATIC = 2;
94  }
95
96  // The resource name of the label.
97  // Format: accounts/{account}/labels/{label}
98  string name = 1;
99
100  // Output only. The ID of the label.
101  int64 label_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
102
103  // Output only. The ID of account this label belongs to.
104  int64 account_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
105
106  // The display name of this label.
107  optional string display_name = 4;
108
109  // The description of this label.
110  optional string description = 5;
111
112  // Output only. The type of this label.
113  LabelType label_type = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
114}
115
116// Request message for the `ListAccountLabels` method.
117message ListAccountLabelsRequest {
118  // Required. The parent account.
119  // Format: accounts/{account}
120  string parent = 1 [
121    (google.api.field_behavior) = REQUIRED,
122    (google.api.resource_reference) = {
123      child_type: "css.googleapis.com/AccountLabel"
124    }
125  ];
126
127  // The maximum number of labels to return. The service may return fewer than
128  // this value.
129  // If unspecified, at most 50 labels will be returned.
130  // The maximum value is 1000; values above 1000 will be coerced to 1000.
131  int32 page_size = 2;
132
133  // A page token, received from a previous `ListAccountLabels` call.
134  // Provide this to retrieve the subsequent page.
135  //
136  // When paginating, all other parameters provided to `ListAccountLabels` must
137  // match the call that provided the page token.
138  string page_token = 3;
139}
140
141// Response message for the `ListAccountLabels` method.
142message ListAccountLabelsResponse {
143  // The labels from the specified account.
144  repeated AccountLabel account_labels = 1;
145
146  // A token, which can be sent as `page_token` to retrieve the next page.
147  // If this field is omitted, there are no subsequent pages.
148  string next_page_token = 2;
149}
150
151// Request message for the 'CreateAccountLanel' method.
152message CreateAccountLabelRequest {
153  // Required. The parent account.
154  // Format: accounts/{account}
155  string parent = 1 [
156    (google.api.field_behavior) = REQUIRED,
157    (google.api.resource_reference) = {
158      child_type: "css.googleapis.com/AccountLabel"
159    }
160  ];
161
162  // Required. The label to create.
163  AccountLabel account_label = 2 [(google.api.field_behavior) = REQUIRED];
164}
165
166// Request message for the `UpdateAccountLabel` method.
167message UpdateAccountLabelRequest {
168  // Required. The updated label. All fields must be provided.
169  AccountLabel account_label = 1 [(google.api.field_behavior) = REQUIRED];
170}
171
172// Request message for the 'DeleteAccountLabel' method.
173message DeleteAccountLabelRequest {
174  // Required. The name of the label to delete.
175  // Format:  accounts/{account}/labels/{label}
176  string name = 1 [
177    (google.api.field_behavior) = REQUIRED,
178    (google.api.resource_reference) = {
179      type: "css.googleapis.com/AccountLabel"
180    }
181  ];
182}
183