• 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.merchant.notifications.v1beta;
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";
24import "google/protobuf/field_mask.proto";
25import "google/shopping/type/types.proto";
26
27option go_package = "cloud.google.com/go/shopping/merchant/notifications/apiv1beta/notificationspb;notificationspb";
28option java_multiple_files = true;
29option java_outer_classname = "NotificationsApiProto";
30option java_package = "com.google.shopping.merchant.notifications.v1beta";
31option (google.api.resource_definition) = {
32  type: "merchantapi.googleapis.com/Account"
33  pattern: "accounts/{account}"
34};
35
36// Service to manage notification subscriptions for merchants
37service NotificationsApiService {
38  option (google.api.default_host) = "merchantapi.googleapis.com";
39  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";
40
41  // Gets notification subscriptions for an account.
42  rpc GetNotificationSubscription(GetNotificationSubscriptionRequest)
43      returns (NotificationSubscription) {
44    option (google.api.http) = {
45      get: "/notifications/v1beta/{name=accounts/*/notificationsubscriptions/*}"
46    };
47    option (google.api.method_signature) = "name";
48  }
49
50  // Creates a notification subscription for a merchant. We will allow the
51  // following types of notification subscriptions to exist together (per
52  // merchant as a subscriber per event type):
53  // 1. Subscription for all managed accounts + subscription for self
54  // 2. Multiple "partial" subscriptions for managed accounts + subscription
55  // for self
56  //
57  // we will not allow (per merchant as a subscriber per event type):
58  // 1. multiple self subscriptions.
59  // 2. multiple "all managed accounts" subscriptions.
60  // 3. all and partial subscriptions at the same time.
61  // 4. multiple partial subscriptions for the same target account
62  rpc CreateNotificationSubscription(CreateNotificationSubscriptionRequest)
63      returns (NotificationSubscription) {
64    option (google.api.http) = {
65      post: "/notifications/v1beta/{parent=accounts/*}/notificationsubscriptions"
66      body: "notification_subscription"
67    };
68    option (google.api.method_signature) = "parent,notification_subscription";
69  }
70
71  // Updates an existing notification subscription for a merchant.
72  rpc UpdateNotificationSubscription(UpdateNotificationSubscriptionRequest)
73      returns (NotificationSubscription) {
74    option (google.api.http) = {
75      patch: "/notifications/v1beta/{notification_subscription.name=accounts/*/notificationsubscriptions/*}"
76      body: "notification_subscription"
77    };
78    option (google.api.method_signature) =
79        "notification_subscription,update_mask";
80  }
81
82  // Deletes a notification subscription for a merchant.
83  rpc DeleteNotificationSubscription(DeleteNotificationSubscriptionRequest)
84      returns (google.protobuf.Empty) {
85    option (google.api.http) = {
86      delete: "/notifications/v1beta/{name=accounts/*/notificationsubscriptions/*}"
87    };
88    option (google.api.method_signature) = "name";
89  }
90
91  // Gets all the notification subscriptions for a merchant.
92  rpc ListNotificationSubscriptions(ListNotificationSubscriptionsRequest)
93      returns (ListNotificationSubscriptionsResponse) {
94    option (google.api.http) = {
95      get: "/notifications/v1beta/{parent=accounts/*}/notificationsubscriptions"
96    };
97    option (google.api.method_signature) = "parent";
98  }
99}
100
101// Enum to specify the resource that is being changed to notify the merchant
102// about.
103enum Resource {
104  // Unspecified resource
105  RESOURCE_UNSPECIFIED = 0;
106
107  // Resource type : product
108  PRODUCT = 1;
109}
110
111// Enum to specify the attribute in the resource that is being changed to
112// notify the merchant about.
113enum Attribute {
114  // Unspecified attribute
115  ATTRIBUTE_UNSPECIFIED = 0;
116
117  // Status of the changed entity
118  STATUS = 1;
119}
120
121// Request message for the GetNotificationSubscription method.
122message GetNotificationSubscriptionRequest {
123  // Required. The `name` of the notification subscription.
124  string name = 1 [
125    (google.api.field_behavior) = REQUIRED,
126    (google.api.resource_reference) = {
127      type: "merchantapi.googleapis.com/NotificationSubscription"
128    }
129  ];
130}
131
132// Request message for the CreateNotificationSubscription method.
133message CreateNotificationSubscriptionRequest {
134  // Required. The merchant account that owns the new notification subscription.
135  // Format: `accounts/{account}`
136  string parent = 1 [
137    (google.api.field_behavior) = REQUIRED,
138    (google.api.resource_reference) = {
139      child_type: "merchantapi.googleapis.com/NotificationSubscription"
140    }
141  ];
142
143  // Required. The notification subscription to create.
144  NotificationSubscription notification_subscription = 2
145      [(google.api.field_behavior) = REQUIRED];
146}
147
148// Request message for the UpdateNotificationSubscription method.
149message UpdateNotificationSubscriptionRequest {
150  // Required. The new version of the notification subscription that should be
151  // updated.
152  NotificationSubscription notification_subscription = 1
153      [(google.api.field_behavior) = REQUIRED];
154
155  // List of fields being updated.
156  google.protobuf.FieldMask update_mask = 2;
157}
158
159// Request message for the DeleteNotificationSubscription method.
160message DeleteNotificationSubscriptionRequest {
161  // Required. The name of the notification subscription to be deleted.
162  string name = 1 [
163    (google.api.field_behavior) = REQUIRED,
164    (google.api.resource_reference) = {
165      type: "merchantapi.googleapis.com/NotificationSubscription"
166    }
167  ];
168}
169
170// Request message for the ListNotificationSubscription method.
171message ListNotificationSubscriptionsRequest {
172  // Required. The merchant account who owns the notification subscriptions.
173  // Format: `accounts/{account}`
174  string parent = 1 [
175    (google.api.field_behavior) = REQUIRED,
176    (google.api.resource_reference) = {
177      child_type: "merchantapi.googleapis.com/NotificationSubscription"
178    }
179  ];
180
181  // The maximum number of notification subscriptions to return in a page.
182  // The default value for `page_size` is 100. The
183  // maximum value is `200`. Values above `200` will be coerced to `200`.
184  int32 page_size = 2;
185
186  // Token (if provided) to retrieve the subsequent page. All other parameters
187  // must match the original call that provided the page token.
188  string page_token = 3;
189}
190
191// Response message for the ListNotificationSubscription method.
192message ListNotificationSubscriptionsResponse {
193  // The list of notification subscriptions requested by the merchant.
194  repeated NotificationSubscription notification_subscriptions = 1;
195
196  // A token, which can be sent as `page_token` to retrieve the next page.
197  // If this field is omitted, there are no subsequent pages.
198  string next_page_token = 2;
199}
200
201// Represents a notification subscription owned by a Merchant account.
202message NotificationSubscription {
203  option (google.api.resource) = {
204    type: "merchantapi.googleapis.com/NotificationSubscription"
205    pattern: "accounts/{account}/notificationsubscriptions/{notification_subscription}"
206  };
207
208  // Represents the event type that the merchant is interested in receiving
209  // notifications for.
210  enum NotificationEventType {
211    // Notifications event type is unspecified.
212    NOTIFICATION_EVENT_TYPE_UNSPECIFIED = 0;
213
214    // Notification of product status changes, for example when product becomes
215    // disapproved.
216    PRODUCT_STATUS_CHANGE = 1;
217  }
218
219  oneof interested_in {
220    // If this value is true, the requesting account is notified of the
221    // specified event for all managed accounts (can be subaccounts or other
222    // linked accounts) including newly added accounts on a daily basis.
223    bool all_managed_accounts = 3;
224
225    // The `name` of the account you want to receive notifications for.
226    // Format: `accounts/{account}`
227    string target_account = 4;
228  }
229
230  // Output only. The `name` of the notification configuration. Generated by the
231  // Content API upon creation of a new `NotificationSubscription`. The
232  // `account` represents the merchant ID of the merchant that owns the
233  // configuration. Format:
234  // `accounts/{account}/notificationsubscriptions/{notification_subscription}`
235  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
236
237  // The event that the merchant wants to be notified about.
238  NotificationEventType registered_event = 2;
239
240  // URL to be used to push the notification to the merchant.
241  string call_back_uri = 5;
242}
243
244// The change that happened to the product including old value, new value,
245// country code as the region code and reporting context.
246message ProductChange {
247  // The old value of the changed resource or attribute.
248  optional string old_value = 1;
249
250  // The new value of the changed resource or attribute.
251  optional string new_value = 2;
252
253  // Countries that have the change (if applicable)
254  optional string region_code = 3;
255
256  // Reporting contexts that have the change (if applicable)
257  optional google.shopping.type.ReportingContext.ReportingContextEnum
258      reporting_context = 4;
259}
260
261// The message that the merchant will receive to notify about product status
262// change event
263message ProductStatusChangeMessage {
264  // The target account that owns the entity that changed.
265  // Format : `accounts/{merchant_id}`
266  optional string account = 1;
267
268  // The account that manages the merchant's account. can be the same as
269  // merchant id if it is standalone account. Format :
270  // `accounts/{service_provider_id}`
271  optional string managing_account = 2;
272
273  // The resource that changed, in this case it will always be `Product`.
274  optional Resource resource_type = 3;
275
276  // The attribute in the resource that changed, in this case it will be always
277  // `Status`.
278  optional Attribute attribute = 4;
279
280  // A message to describe the change that happened to the product
281  repeated ProductChange changes = 5;
282
283  // The product id.
284  optional string resource_id = 6;
285
286  // The product name.
287  // Format: `{product.name=accounts/{account}/products/{product}}`
288  optional string resource = 7;
289}
290