// Copyright 2019 Make.TV 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 "team/team.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; option go_package = "git.ltnglobal.com/make.tv/genproto/api;api"; service TeamService { // Lists teams. // // This call will only list teams the current user is a member of. // If the user is not part of a team, the list is effectively empty. rpc ListTeams(ListTeamsRequest) returns (ListTeamsResponse) { option (google.api.http) = { get: "/v1/teams" }; } // Gets a team. rpc GetTeam(GetTeamRequest) returns (Team) { option (google.api.http) = { get: "/v1/teams/{team_id}" }; } // Creates a team. rpc CreateTeam (CreateTeamRequest) returns (Team) { option (google.api.http) = { post: "/v1/teams" body: "team" }; } // Updates a team. rpc UpdateTeam (UpdateTeamRequest) returns (Team) { option (google.api.http) = { patch: "/v1/teams/{team.id}" body: "team" }; } // Deletes a team. rpc DeleteTeam (DeleteTeamRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/teams/{team_id}" }; } // Get current roles. // // Used by a client to identify their roles within a team. rpc GetCurrentRoles (GetCurrentRolesRequest) returns (GetCurrentRolesResponse) { option (google.api.http) = { get: "/v1/teams/{team_id}:getCurrentRoles" }; } // Invite a user to a team. rpc InviteUser (InviteUserRequest) returns (InviteUserResponse) { option (google.api.http) = { post: "/v1/teams/{team_id}:inviteUser" body: "*" }; } // Lists members of a team. rpc ListTeamMembers (ListTeamMembersRequest) returns (ListTeamMembersResponse) { option (google.api.http) = { get: "/v1/teams/{team_id}/members" }; } // Delete a member from a team. rpc DeleteTeamMember (DeleteTeamMemberRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/teams/{team_id}/members/{user_id}" }; } } // Request message for [ListTeams][tv.make.api.TeamService.ListTeams]. message ListTeamsRequest { // The maximum number of items to return. int32 page_size = 1; // The next_page_token value returned from a previous List request, if any. string page_token = 2; } // Response message for [ListTeams][tv.make.api.TeamService.ListTeams]. message ListTeamsResponse { // The list of teams. repeated Team teams = 1; // Token to retrieve the next page of results, or empty if there are no // more results in the list. string next_page_token = 2; } // Request message for [GetTeam][tv.make.api.TeamService.GetTeam]. message GetTeamRequest { // The unique identifier of the team. string team_id = 1; } // Request message for [CreateTeam][tv.make.api.TeamService.CreateTeam]. message CreateTeamRequest { // The team to create. Team team = 1; string request_id = 2; } // Request message for [UpdateTeam][tv.make.api.TeamService.UpdateTeam]. message UpdateTeamRequest { // The team resource which replaces the resource on the server. Team team = 1; // The update mask applies to the resource. For the `FieldMask` definition, // see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask // Allowed update paths // - "team.display_name" // - "team.asset_lifetime_duration" - Note that this value has to be a multiple of days google.protobuf.FieldMask update_mask = 2; } // Request message for [DeleteTeam][tv.make.api.TeamService.DeleteTeam]. message DeleteTeamRequest { // The unique identifier of the team. string team_id = 1; } // Request message for [GetCurrentRole][tv.make.api.TeamService.GetCurrentRole]. message GetCurrentRolesRequest { // The unique identifier of the team. string team_id = 1; } // Response message for [GetCurrentRole][tv.make.api.TeamService.GetCurrentRole]. message GetCurrentRolesResponse { // The list of role names that apply. // // Deprecated: Will be dropped in future in favor of the role_ids field. repeated string roles = 1 [deprecated=true]; // The list of role ids that apply. repeated string role_ids = 2; } // Request message for [InviteUser][tv.make.api.TeamService.InviteUser]. message InviteUserRequest { // The unique identifier of the team. string team_id = 1; // The e-mail address of the invitee. string email = 2; // Role ids that apply to this user. repeated string role_ids = 3; } // Response message for [InviteUser][tv.make.api.TeamService.InviteUser]. message InviteUserResponse { enum Status { // The invitation status is unspecified. INVITATION_STATUS_UNSPECIFIED = 0; // Invitation E-Mail has been sent. E_MAIL_SENT = 1; // Invitation E-Mail has been re-sent. // // This indicates an invite was already pending. E_MAIL_RESENT = 2; // No operation as the user is already a member of the team. NOOP = 3; // The user has been added to the team without asking for the user's consent. ADDED_WITHOUT_CONSENT = 4; } // Status of the invitation. Status status = 1; } // Request message for [ListTeamMembers][tv.make.api.TeamService.ListTeamMembers]. message ListTeamMembersRequest { // The unique identifier of the team. string team_id = 1; // The maximum number of items to return. int32 page_size = 2; // The next_page_token value returned from a previous List request, if any. string page_token = 3; } // Response message for [ListMembers][tv.make.api.TeamService.ListMembers]. message ListTeamMembersResponse { // The members of the team. repeated string user_ids = 1; // Token to retrieve the next page of results, or empty if there are no // more results in the list. string next_page_token = 2; } // Request message for [DeleteTeamMember][tv.make.api.TeamService.DeleteTeamMember]. message DeleteTeamMemberRequest { // The unique identifier of the team. string team_id = 1; // The user to remove. string user_id = 2; }