Skip to content

Commit 0fc1ac5

Browse files
author
Laurie T. Malau
committed
[public api] Proto definitions for tokens
1 parent f0a23ac commit 0fc1ac5

File tree

6 files changed

+2151
-0
lines changed

6 files changed

+2151
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
syntax = "proto3";
2+
3+
package gitpod.experimental.v1;
4+
5+
option go_package = "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1";
6+
7+
import "google/protobuf/timestamp.proto";
8+
9+
service TokenService {
10+
11+
// CreateToken creates a new token and returns it.
12+
rpc CreateToken(CreateTokenRequest) returns (CreateTokenResponse) {}
13+
14+
// GetToken returns one token.
15+
rpc GetToken(GetTokenRequest) returns (GetTokenResponse) {}
16+
17+
// ListTokens returns a list of tokens.
18+
rpc ListTokens(ListTokensRequest) returns (ListTokensResponse) {}
19+
20+
// UpdateToken either regenerates a token or updates a token's scopes.
21+
rpc UpdateToken(UpdateTokenRequest) returns (UpdateTokenResponse) {}
22+
23+
// DeleteToken removes a token.
24+
rpc DeleteToken(DeleteTokenRequest) returns (DeleteTokenResponse) {}
25+
}
26+
27+
message CreateTokenRequest {
28+
PersonalAccessToken token = 1;
29+
}
30+
31+
message CreateTokenResponse {
32+
PersonalAccessToken token = 1;
33+
}
34+
35+
message GetTokenRequest {
36+
string token_hash = 1;
37+
string user_id = 2;
38+
}
39+
40+
message GetTokenResponse {
41+
PersonalAccessToken token = 1;
42+
}
43+
44+
message ListTokensRequest {
45+
string user_id = 1;
46+
}
47+
48+
message ListTokensResponse {
49+
repeated PersonalAccessToken tokens = 1;
50+
}
51+
52+
message UpdateTokenRequest {
53+
bool regenerate = 1;
54+
bool update_scopes = 2;
55+
repeated Scope scopes = 3;
56+
}
57+
58+
message UpdateTokenResponse {
59+
PersonalAccessToken token = 1;
60+
}
61+
62+
message DeleteTokenRequest {
63+
string token_hash = 1;
64+
string user_id = 2;
65+
}
66+
67+
message DeleteTokenResponse {
68+
}
69+
70+
message Scope {
71+
repeated string options = 1;
72+
}
73+
74+
message PersonalAccessToken {
75+
string token_hash = 1;
76+
string user_id = 2;
77+
string name = 3;
78+
string description = 4;
79+
google.protobuf.Timestamp expiration_time = 5;
80+
repeated Scope scopes = 7;
81+
google.protobuf.Timestamp created_at = 8;
82+
google.protobuf.Timestamp last_modified = 9;
83+
}

0 commit comments

Comments
 (0)