summaryrefslogtreecommitdiffstats
path: root/lib/sellershut-core/proto/users/users.proto
blob: 8c7b41d6a87922d3b865afc87113eebbf3f0cf1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
syntax = "proto3";

package users;

import "google/protobuf/timestamp.proto";

enum UserType {
  PERSON = 0;
  APPLICATION = 1;
  GROUP = 2;
  ORGANIZATION = 3;
  SERVICE = 4;
}

// A message representing a user user
message User {
  // Unique identifier for the user
  string id = 1;
  // Email address of the user
  optional string email = 2;
  // Unique username chosen by the user
  string username = 3;
  // URL to the user's avatar image
  optional string avatar = 4;
  // Timestamp when the user was created
  google.protobuf.Timestamp created_at = 5;
  // Timestamp when the user was last updated
  google.protobuf.Timestamp updated_at = 6;
  // User-provided description or bio
  optional string description = 7;
  // User type
  UserType user_type = 8;
  // Public key
  string public_key = 9;
  // Inbox
  string inbox = 10;
  // Outbox
  string outbox = 11;
  // Local
  bool local = 12;
}

// Request message for creating a new user
message CreateUserRequest {
  // Email address of the new user
  string email = 1;
  // Avatar for the new user
  optional string avatar = 2;
}

// Response message for CreateUser RPC
message CreateUserResponse {
  // Temporary assigned id 
  string temp_id = 1;
}

// Message to finalise user creation
message CompleteUserRequest {
  // ID of the user to finalise
  string id = 1;
  // Required: username to finalise the user
  string username = 2;
  // Optional: user-provided description
  optional string description = 3;
  // Optional: update avatar
  optional string avatar = 4;
  // Inbox URL for this user
  string inbox = 5;
  // Outbox URL for this user
  string outbox = 6;
  // Is this user local or remote
  bool local = 7;
  // Public key for this user
  string public_key = 8;
  // User type
  UserType user_type = 9;
}

// Users gRPC service
service UsersService {
  // Create a new user
  rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
  // Complete user
  rpc CompleteUser (CompleteUserRequest) returns (User);
}