syntax = "proto3";

// Run `make grpc` at the top level directory to regenerate Go source code.

package apipb;

message Client {
  string id = 1;
  string secret = 2;

  repeated string redirect_uris = 3;
  repeated string trusted_peers = 4;

  bool public = 5; 

  string name = 6;
  string logo_url = 7;
}

message CreateClientReq {
  Client client = 1;
}

message CreateClientResp {
  Client client = 1;
}

message UpdateClientReq {
  string id = 1;

  // Empty strings indicate that string fields should not be updated.
  string secret = 2;
  string name = 3;
  string logo_url = 4;

  bool make_public = 5;
  bool make_private = 6;

  // If no redirect URIs are specified, the current redirect URIs are preserved.
  repeated string redirect_uris = 7;
}

message UpdateClientResp {
  Client client = 1;
}

message ListClientsReq {
}

message ListClientsResp {
  repeated Client clients = 1;
}

message DeleteClientReq {
  string id = 1;
}

message DeleteClientResp {}

message GetClientReq {
  string id = 1;
}

message GetClientResp {
  Client client = 1;
}

service Storage {
  rpc CreateClient(CreateClientReq) returns (CreateClientResp) {}
  rpc DeleteClient(DeleteClientReq) returns (DeleteClientReq) {}
  rpc GetClient(GetClientReq) returns (GetClientResp) {}
  rpc ListClients(ListClientsReq) returns (ListClientsResp) {}
  rpc UpdateClient(UpdateClientReq) returns (UpdateClientResp) {}
}