server.proto 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. syntax = "proto3";
  2. package chatto.discovery.v1;
  3. import "chatto/api/v1/server.proto";
  4. import "google/protobuf/timestamp.proto";
  5. // Request for public server metadata.
  6. message GetServerRequest {}
  7. // Public metadata clients need before they can authenticate or render the
  8. // initial server view.
  9. message GetServerResponse {
  10. // Public server profile and branding.
  11. chatto.api.v1.ServerPublicProfile profile = 1;
  12. // Login and registration options.
  13. chatto.api.v1.ServerLogin login = 2;
  14. // Whether first-run setup is available before normal registration.
  15. bool setup_required = 3;
  16. }
  17. // Request for the public Neighbor directory.
  18. message ListNeighborsRequest {}
  19. // Publicly advertised servers. The response has no ordering contract.
  20. message ListNeighborsResponse {
  21. reserved 2;
  22. reserved "neighbors";
  23. // Canonical origins of the advertised servers.
  24. repeated string origins = 1;
  25. }
  26. // Request for the Neighborhood that this server has discovered.
  27. message ListNeighborhoodServersRequest {}
  28. // One server in the Neighborhood of the called server.
  29. message NeighborhoodServer {
  30. // Canonical origin of the server.
  31. string origin = 1;
  32. // Public profile that the called server loaded. The welcome message is
  33. // absent. The logo and banner URLs are server-relative paths of copies on
  34. // the called server. Resolve them against the origin of the called server.
  35. chatto.api.v1.ServerPublicProfile profile = 2;
  36. // Whether the called server advertises this server as a Neighbor.
  37. bool direct_neighbor = 3;
  38. // Canonical origins of other servers in the same response that mutually
  39. // recommend this server. The list does not include the called server.
  40. repeated string recommended_by_origins = 4;
  41. }
  42. // Servers that the called server discovered through its Neighbors. The
  43. // called server lists each of its Neighbors whose public profile loaded. It
  44. // also lists servers that a mutually advertising Neighbor recommends when the
  45. // recommendation is also mutual. The response has no ordering contract.
  46. message ListNeighborhoodServersResponse {
  47. // Servers in the Neighborhood.
  48. repeated NeighborhoodServer servers = 1;
  49. // Time when the called server last completed Neighborhood discovery.
  50. // Absent before the first completed discovery.
  51. google.protobuf.Timestamp refreshed_at = 2;
  52. }
  53. // Provides unauthenticated server discovery metadata.
  54. service ServerDiscoveryService {
  55. // Returns public server metadata, branding, registration status, and login
  56. // provider information. This fully public RPC is available before login so
  57. // clients can render the first server screen and authentication choices.
  58. rpc GetServer(GetServerRequest) returns (GetServerResponse) {
  59. option idempotency_level = NO_SIDE_EFFECTS;
  60. }
  61. // Returns the public Neighbor directory without requiring a session.
  62. rpc ListNeighbors(ListNeighborsRequest) returns (ListNeighborsResponse) {
  63. option idempotency_level = NO_SIDE_EFFECTS;
  64. }
  65. // Returns the Neighborhood without requiring a session. The server
  66. // contacts other servers in the background and caches the result. A call
  67. // does not contact other servers, so a client can show the Neighborhood
  68. // without revealing the user's network address to those servers. The
  69. // server refreshes the Neighborhood at least once per hour and soon after
  70. // its Neighbors change.
  71. rpc ListNeighborhoodServers(ListNeighborhoodServersRequest) returns (ListNeighborhoodServersResponse) {
  72. option idempotency_level = NO_SIDE_EFFECTS;
  73. }
  74. }