// 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; // 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"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Creates a user. rpc CreateUser(CreateUserRequest) returns (User) { option (google.api.http) = { post: "/v1beta1/{parent=users}" body: "*" }; option (google.api.method_signature) = "parent,user.display_name,user.email"; option (google.api.method_signature) = "parent,user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; // Test nested method arguments and ensure that order doesn't matter. option (google.api.method_signature) = "parent,user.display_name,user.email,user.hobby.hobby_name,user.song.song_name,user.hobby.weekly_frequency,user.song.song_artist.recording_company.company_name,user.hobby.instruction_manual.title,user.hobby.instruction_manual.subject,user.song.song_artist.artist_name"; } // 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: "*" }; } // 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 use 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 user's favorite hobby. optional Hobby hobby = 10; // The user's song. optional Song song = 11; } message Hobby { // The name of the hobby. string hobby_name = 1; // Weekly frequency this hobby is performed. int32 weekly_frequency = 2; // The instruction manual for the hobby. Book instruction_manual = 3; } message Book { // The title of the instruction manual. string title = 1; // The subject of the instruction manual. string subject = 2; } message Song { // The name of the song. string song_name = 1; // The song's artist. Artist song_artist = 2; } message Artist { // The name of the artist. string artist_name = 1; // The artist's recording company. RecordingCompany recording_company = 2; } message RecordingCompany { // The recording company's name string company_name = 1; // The year the company was founded. int32 founding_year = 2; } // The request message for the google.showcase.v1beta1.Identity\CreateUser // method. message CreateUserRequest { string parent = 1 [ (google.api.resource_reference).child_type = "showcase.googleapis.com/User", (google.api.field_behavior) = REQUIRED ]; // The user to create. User user = 2 [(google.api.field_behavior) = REQUIRED]; } // 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 wich 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; }