// 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 "account/account.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 AccountService { // Lists accounts. rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) { option (google.api.http) = { get: "/v1/teams/{team_id}/accounts" }; } // Gets an account. rpc GetAccount(GetAccountRequest) returns (Account) { option (google.api.http) = { get: "/v1/teams/{team_id}/accounts/{account_id}" }; } // Creates an account. rpc CreateAccount(CreateAccountRequest) returns (Account) { option (google.api.http) = { post: "/v1/teams/{team_id}/accounts" body: "account" }; } // Updates an account. rpc UpdateAccount(UpdateAccountRequest) returns (Account) { option (google.api.http) = { patch: "/v1/teams/{account.team_id}/accounts/{account.id}" body: "account" }; } // Deletes an account. rpc DeleteAccount(DeleteAccountRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/teams/{team_id}/accounts/{account_id}" }; } // Connects an account. // // Calling connect on an account resource will establish the connection between // the account and the 3rd-party account provider. rpc ConnectAccount(ConnectAccountRequest) returns (ConnectAccountResponse) { option (google.api.http) = { post: "/v1/teams/{team_id}/accounts/{account_id}:connect" }; } // Refreshes an account. // // Calling refresh will ensure the validity of an account and also try // to re-establish a connection if it was missing. rpc RefreshAccount(RefreshAccountRequest) returns (RefreshAccountResponse) { option (google.api.http) = { post: "/v1/teams/{team_id}/accounts/{account_id}:refresh" }; } } // Request message for [ListAccounts][tv.make.api.AccountService.ListAccounts]. message ListAccountsRequest { // The unique identifier of the team owning the account. 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; // Specifies the result ordering for List requests. string order_by = 4; } // Response message for [ListAccounts][tv.make.api.AccountService.ListAccounts]. message ListAccountsResponse { // The list of accounts. repeated Account accounts = 1; // Token to retrieve the next page of results, or empty if there are no // more results in the list. string next_page_token = 3; } // Request message for [GetAccount][tv.make.api.AccountService.GetAccount]. message GetAccountRequest { // The unique identifier of the account. string account_id = 1; // The unique identifier of the team owning the account. string team_id = 2; } // Request message for [CreateAccount][tv.make.api.AccountService.CreateAccount]. message CreateAccountRequest { // The unique identifier of the team owning the account. string team_id = 1; // The account to create. Account account = 2; } // Request message for [UpdateAccount][tv.make.api.AccountService.UpdateAccount]. message UpdateAccountRequest { // The account resource which replaces the resource on the server. Account account = 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; } // Request message for [DeleteAccount][tv.make.api.AccountService.DeleteAccount]. message DeleteAccountRequest { // The unique identifier of the account. string account_id = 1; // The unique identifier of the team owning the account. string team_id = 2; } // Request message for [ConnectAccount][tv.make.api.AccountService.ConnectAccount]. message ConnectAccountRequest { // The unique identifier of the account. string account_id = 1; // The unique identifier of the team owning the account. string team_id = 2; } // Response message for [ConnectAccount][tv.make.api.AccountService.ConnectAccount]. message ConnectAccountResponse{ // The url of the authorization server to connect the account. string auth_url = 1; } // Request message for [RefreshAccount][tv.make.api.AccountService.RefreshAccount]. message RefreshAccountRequest { // The unique identifier of the account. string account_id = 1; // The unique identifier of the team owning the account. string team_id = 2; } // Response message for [RefreshAccount][tv.make.api.AccountService.RefreshAccount]. message RefreshAccountResponse{ // The refreshed account resource. Account account = 1; // The url of the authorization server to connect the account. // // This field is empty if the account's status was already valid. string auth_url = 2; }