// Copyright 2022 LTN Global Communications, Inc. // // 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 // // http://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"; package tv.make.api; import "user/user.proto"; import "user/avatar.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option go_package = "git.ltnglobal.com/make.tv/genproto/api;api"; service UserService { // Retrieves a user. Returns NOT_FOUND if no such user exists. rpc GetUser(GetUserRequest) returns (User) { option (google.api.http) = { get: "/v1/users/{user_id}" }; } // Gets a batch of users. rpc BatchGetUsers (BatchGetUsersRequest) returns (BatchGetUsersResponse) { option (google.api.http) = { get: "/v1/users:batchGet" }; } // Creates a user. rpc CreateUser (CreateUserRequest) returns (User) { option (google.api.http) = { post: "/v1/users" body: "user" }; } // -- // Deletes the current user. // // Returns UNAUTHENTICATED if there is no user attached to the current session. rpc DeleteCurrentUser (DeleteCurrentUserRequest) returns (DeleteCurrentUserResponse) { option (google.api.http) = { post: "/v1/users:deleteCurrentUser" body: "*" }; } // Updates information of the current user. // // The update MUST NOT touch the user's email and/or password. // Use UpdateEmail or UpdatePassword instead. // // Returns UNAUTHENTICATED if there is no user attached to the current session. rpc UpdateCurrentUser (UpdateCurrentUserRequest) returns (UpdateCurrentUserResponse) { option (google.api.http) = { post: "/v1/users:updateCurrentUser" body: "*" }; } // Updates the email address of the current user. // // Returns UNAUTHENTICATED if there is no user attached to the current session. rpc UpdateEmail (UpdateEmailRequest) returns (UpdateEmailResponse) { option (google.api.http) = { post: "/v1/users:updateEmail" body: "*" }; } // Updates the password of the current user. // // Returns UNAUTHENTICATED if there is no user attached to the current session. rpc UpdatePassword (UpdatePasswordRequest) returns (UpdatePasswordResponse) { option (google.api.http) = { post: "/v1/users:updatePassword" body: "*" }; } // Start the password reset process for a given email. // // This method won't fail if the given email is unknown. // // Does not require the token to be in the request context. rpc StartPasswordReset (StartPasswordResetRequest) returns (StartPasswordResetResponse) { option (google.api.http) = { post: "/v1/users:startPasswordReset" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: {} }; } // Confirm and execute a password reset. // // Does not require the token to be in the request context. rpc ConfirmPasswordReset (ConfirmPasswordResetRequest) returns (ConfirmPasswordResetResponse) { option (google.api.http) = { post: "/v1/users:confirmPasswordReset" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: {} }; } // Accept the invitation into a team. // // Does not require the token to be in the request context. rpc AcceptTeamInvitation(AcceptTeamInvitationRequest) returns (AcceptTeamInvitationResponse) { option (google.api.http) = { post: "/v1/users:acceptTeamInvitation" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: {} }; } // Update the users avatar by uploading a picture. // // Only quadratic pictures are allowed. rpc UploadUserAvatar(stream UploadUserAvatarRequest) returns (UploadUserAvatarResponse) { option (google.api.http) = { post: "/v1/users/-/avatar:upload", body: "*" }; } // Get an avatar for a user. // // Returns the he next biggest or equal avatar according to the provided size. rpc GetUserAvatar(GetUserAvatarRequest) returns (Avatar) { option (google.api.http) = { get: "/v1/users/{user_id}/avatar" }; } // Delete avatars for a user rpc DeleteUserAvatar(DeleteUserAvatarRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/users/{user_id}/avatar" }; } // Gets a batch avatars for multiple users. rpc BatchGetUserAvatar (BatchGetUserAvatarRequest) returns (BatchGetUserAvatarResponse) { option (google.api.http) = { get: "/v1/users/-/avatar:batchGet" }; } // Lists external devices rpc ListDeprecatedUserDeviceDestinations(ListDeprecatedUserDeviceDestinationsRequest) returns (ListDeprecatedUserDeviceDestinationsResponse) { option (google.api.http) = { post: "/v1/users:listDeprecatedUserDeviceDestinations" }; } } // Request message for [GetUser][tv.make.api.UserService.GetUser]. message GetUserRequest { // The unique identifier of the user. string user_id = 1; } // Request message for [BatchGetUsers][tv.make.api.UserService.BatchGetUsers]. message BatchGetUsersRequest { // The users ids of the users which should be returned. repeated string user_ids = 1; } // Response message for [BatchGetUsers][tv.make.api.UserService.BatchGetUsers]. message BatchGetUsersResponse { // The users listed. repeated User users = 1; } // Request message for [CreateUser][tv.make.api.UserService.CreateUser]. message CreateUserRequest { // The user to create. User user = 1; // The initial password for the user. string password = 2; // The request_id for deduplication. string request_id = 3; } // Request message for [DeleteCurrentUser][tv.make.api.UserService.DeleteCurrentUser]. message DeleteCurrentUserRequest { // The user's password string password = 1; } // Response message for [DeleteCurrentUser][tv.make.api.UserService.DeleteCurrentUser]. message DeleteCurrentUserResponse {} // Request message for [UpdateCurrentUser][tv.make.api.UserService.UpdateCurrentUser]. message UpdateCurrentUserRequest { // The user resource which replaces the resource on the server. User user = 1; // The update mask applies to the resource. For the `FieldMask` definition, // see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask google.protobuf.FieldMask update_mask = 2; } // Response message for [UpdateCurrentUser][tv.make.api.UserService.UpdateCurrentUser]. message UpdateCurrentUserResponse { // The updated user. User user = 1; } // Request message for [UpdateEmail][tv.make.api.UserService.UpdateEmail]. message UpdateEmailRequest { // The user's password string password = 1; // The new email address. string email = 2; } // Response message for [UpdateEmail][tv.make.api.UserService.UpdateEmail]. message UpdateEmailResponse { // The updated user. User user = 1; } // Request message for [UpdatePassword][tv.make.api.UserService.UpdatePassword]. message UpdatePasswordRequest { // The old password of the user for verification. string old_password = 1; // The new password to set for the user. string new_password = 2; } // Response message for [UpdatePassword][tv.make.api.UserService.UpdatePassword]. message UpdatePasswordResponse {} // Request message for [StartPasswordReset][tv.make.api.UserService.StartPasswordReset]. message StartPasswordResetRequest { // The email address of the user. If the email address is unknown the result will still be "ok". string email = 1; } // Response message for [StartPasswordReset][tv.make.api.UserService.StartPasswordReset]. message StartPasswordResetResponse {} // Request message for [ConfirmPasswordReset][tv.make.api.UserService.ConfirmPasswordReset]. message ConfirmPasswordResetRequest { // The token for validation of the reset. string reset_token = 1; // The new password for the user. string password = 2; } // Response message for [ConfirmPasswordReset][tv.make.api.UserService.ConfirmPasswordReset]. message ConfirmPasswordResetResponse {} // Request message for [AcceptTeamInvitation][tv.make.api.UserService.AcceptTeamInvitation]. message AcceptTeamInvitationRequest { // The user accepting the invitation string user_id = 1; // The invitation code sent to the user. string invitation_code = 2; } // Response message for [AcceptTeamInvitation][tv.make.api.UserService.AcceptTeamInvitation]. message AcceptTeamInvitationResponse {} // Request message for [UploadUserAvatar][tv.make.api.UserService.UploadUserAvatar]. message UploadUserAvatarRequest { message InitialRequest { // Size of the image in bytes int64 size_bytes = 1; // The user related to the avatar string user_id = 2; } // One chunk of data. message DataChunk { bytes data = 1; } // End of stream message EndOfStream{} oneof set_avatar_create_request_type { // The initial request MUST be sent at the beginning of the stream. InitialRequest initial_request = 1; // One or more data chunks. // // Accumulated size of data chunks most not exceed size_bytes. DataChunk data_chunk = 2; // Signals the end of the stream. EndOfStream end_of_stream = 3; } } // Response message for [UploadUserAvatar][tv.make.api.UserService.UploadUserAvatar]. message UploadUserAvatarResponse {} // Request message for [GetUserAvatar][tv.make.api.UserService.GetUserAvatar]. message GetUserAvatarRequest { // The unique identifier of the user. string user_id = 1; // The size (in pixels) of the avatar wanted. int32 size_pixels = 2; } // Request message for [DeleteUserAvatars][tv.make.api.UserService.DeleteUserAvatars]. message DeleteUserAvatarRequest { // The unique identifier of the user. string user_id = 1; } // Request message for [BatchGetUserAvatar][tv.make.api.UserService.BatchGetUserAvatar]. message BatchGetUserAvatarRequest { // The users ids of the avatars which should be returned. repeated string user_ids = 1; // The size (in pixels) for all avatars. int32 size_pixels = 2; } // Response message for [BatchGetUserAvatar][tv.make.api.UserService.BatchGetUserAvatar]. message BatchGetUserAvatarResponse { repeated Avatar avatars = 1; } // Request message for [ListDeprecatedUserDeviceDestinations][tv.make.api.UserService.ListDeprecatedUserDeviceDestinations]. message ListDeprecatedUserDeviceDestinationsRequest { // Show only active devices. bool only_active = 1; } message DeprecatedUserDeviceDestination { string id = 1; string display_name = 2; string team_id = 3; string team_display_name = 4; } // Response message for [ListDeprecatedUserDeviceDestinations][tv.make.api.UserService.ListDeprecatedUserDeviceDestinations]. message ListDeprecatedUserDeviceDestinationsResponse { // The list of streamtags. repeated DeprecatedUserDeviceDestination streamtags = 1; // The list of productions. repeated DeprecatedUserDeviceDestination productions = 2; }