mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
feat: add new api services (#5619)
* feat: add new services * improve demos and comments * remove unused field * add comment to demo proto calls * Apply suggestions from code review Co-authored-by: Silvan <silvan.reusser@gmail.com> --------- Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
12
proto/zitadel/session/v2alpha/session.proto
Normal file
12
proto/zitadel/session/v2alpha/session.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.session.v2alpha;
|
||||
|
||||
import "zitadel/user/v2alpha/user.proto";
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/session/v2alpha;session";
|
||||
|
||||
message Session {
|
||||
string id = 1;
|
||||
zitadel.user.v2alpha.User user = 2;
|
||||
}
|
33
proto/zitadel/session/v2alpha/session_service.proto
Normal file
33
proto/zitadel/session/v2alpha/session_service.proto
Normal file
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.session.v2alpha;
|
||||
|
||||
import "zitadel/options.proto";
|
||||
import "zitadel/session/v2alpha/session.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/session/v2alpha;session";
|
||||
|
||||
service SessionService {
|
||||
|
||||
// GetSession is to demonstrate an authenticated request, where the authenticated user (usage of another grpc package) is returned
|
||||
//
|
||||
// this request is subject to change and currently used for demonstration only
|
||||
rpc GetSession (GetSessionRequest) returns (GetSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2alpha/sessions/{id}"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetSessionRequest{
|
||||
string id = 1;
|
||||
}
|
||||
message GetSessionResponse{
|
||||
Session session = 1;
|
||||
}
|
9
proto/zitadel/user/v2alpha/user.proto
Normal file
9
proto/zitadel/user/v2alpha/user.proto
Normal file
@@ -0,0 +1,9 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.user.v2alpha;
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v2alpha;user";
|
||||
|
||||
message User {
|
||||
string id = 1;
|
||||
}
|
78
proto/zitadel/user/v2alpha/user_service.proto
Normal file
78
proto/zitadel/user/v2alpha/user_service.proto
Normal file
@@ -0,0 +1,78 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.user.v2alpha;
|
||||
|
||||
import "zitadel/options.proto";
|
||||
import "zitadel/user/v2alpha/user.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v2alpha;user";
|
||||
|
||||
service UserService {
|
||||
|
||||
// TestGet simply demonstrates how the context (org, instance) could be handled in a GET request //
|
||||
//
|
||||
// this request is subject to change and currently used for demonstration only
|
||||
rpc TestGet (TestGetRequest) returns (TestGetResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2alpha/users/test"
|
||||
};
|
||||
}
|
||||
|
||||
// TestPOST simply demonstrates how the context (org, instance) could be handled in a POST request
|
||||
//
|
||||
// this request is subject to change and currently used for demonstration only
|
||||
rpc TestPost (TestPostRequest) returns (TestPostResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2alpha/users/test"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// TestAuth demonstrates how the context (org, instance) could be handled in combination of the authorized context
|
||||
//
|
||||
// this request is subject to change and currently used for demonstration only
|
||||
rpc TestAuth (TestAuthRequest) returns (TestAuthResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2alpha/users/test_auth"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message TestGetRequest{
|
||||
Context ctx = 1;
|
||||
}
|
||||
|
||||
message TestGetResponse{
|
||||
string ctx = 1;
|
||||
}
|
||||
|
||||
message TestPostRequest{
|
||||
Context ctx = 1;
|
||||
}
|
||||
|
||||
message TestPostResponse{
|
||||
string ctx = 1;
|
||||
}
|
||||
|
||||
message TestAuthRequest{
|
||||
Context ctx = 1;
|
||||
}
|
||||
|
||||
message TestAuthResponse{
|
||||
User user = 1;
|
||||
Context ctx = 2;
|
||||
}
|
||||
|
||||
message Context {
|
||||
oneof ctx {
|
||||
bool instance = 1;
|
||||
string org_id = 2;
|
||||
string org_domain = 3;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user