-
Notifications
You must be signed in to change notification settings - Fork 49
/
identity.proto
186 lines (157 loc) · 5.77 KB
/
identity.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
package google.showcase.v1beta1;
option go_package = "github.com/googleapis/gapic-showcase/server/genproto";
option java_package = "com.google.showcase.v1beta1";
option java_multiple_files = true;
option ruby_package = "Google::Showcase::V1beta1";
// A simple identity service.
service Identity {
// This service is meant to only run locally on the port 7469 (keypad digits
// for "show").
option (google.api.default_host) = "localhost:7469";
// Creates a user.
rpc CreateUser(CreateUserRequest) returns (User) {
option (google.api.http) = {
post: "/v1beta1/users"
body: "*"
};
option (google.api.method_signature) = "user.display_name,user.email";
option (google.api.method_signature) =
"user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet";
}
// Retrieves the User with the given uri.
rpc GetUser(GetUserRequest) returns (User) {
option (google.api.http) = {
get: "/v1beta1/{name=users/*}"
};
option (google.api.method_signature) = "name";
}
// Updates a user.
rpc UpdateUser(UpdateUserRequest) returns (User) {
option (google.api.http) = {
patch: "/v1beta1/{user.name=users/*}"
body: "user"
};
}
// Deletes a user, their profile, and all of their authored messages.
rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=users/*}"
};
option (google.api.method_signature) = "name";
}
// Lists all users.
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
option (google.api.http) = {
get: "/v1beta1/users"
};
}
}
// A user.
message User {
option (google.api.resource) = {
type: "showcase.googleapis.com/User"
pattern: "users/{user}"
};
// The resource name of the user.
string name = 1;
// The display_name of the user.
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
// The email address of the user.
string email = 3 [(google.api.field_behavior) = REQUIRED];
// The timestamp at which the user was created.
google.protobuf.Timestamp create_time = 4
[(google.api.field_behavior) = OUTPUT_ONLY];
// The latest timestamp at which the user was updated.
google.protobuf.Timestamp update_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
// The age of the user in years.
optional int32 age = 6;
// The height of the user in feet.
optional double height_feet = 7;
// The nickname of the user.
//
// (-- aip.dev/not-precedent: An empty string is a valid nickname.
// Ordinarily, proto3_optional should not be used on a `string` field. --)
optional string nickname = 8;
// Enables the receiving of notifications. The default is true if unset.
//
// (-- aip.dev/not-precedent: The default for the feature is true.
// Ordinarily, the default for a `bool` field should be false. --)
optional bool enable_notifications = 9;
}
// The request message for the google.showcase.v1beta1.Identity\CreateUser
// method.
message CreateUserRequest {
// The user to create.
User user = 1;
}
// The request message for the google.showcase.v1beta1.Identity\GetUser
// method.
message GetUserRequest {
// The resource name of the requested user.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/User",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Identity\UpdateUser
// method.
message UpdateUserRequest {
// The user to update.
User user = 1;
// The field mask to determine which fields are to be updated. If empty, the
// server will assume all fields are to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request message for the google.showcase.v1beta1.Identity\DeleteUser
// method.
message DeleteUserRequest {
// The resource name of the user to delete.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/User",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Identity\ListUsers
// method.
message ListUsersRequest {
// The maximum number of users to return. Server may return fewer users
// than requested. If unspecified, server will pick an appropriate default.
int32 page_size = 1;
// The value of google.showcase.v1beta1.ListUsersResponse.next_page_token
// returned from the previous call to
// `google.showcase.v1beta1.Identity\ListUsers` method.
string page_token = 2;
}
// The response message for the google.showcase.v1beta1.Identity\ListUsers
// method.
message ListUsersResponse {
// The list of users.
repeated User users = 1;
// A token to retrieve next page of results.
// Pass this value in ListUsersRequest.page_token field in the subsequent
// call to `google.showcase.v1beta1.Message\ListUsers` method to retrieve the
// next page of results.
string next_page_token = 2;
}