Some basic proto setup (#4)
Some checks failed
Some checks failed
Co-authored-by: Nikolai Rodionov <nrodionov@eos-uptrade.de> Reviewed-on: #4 Co-authored-by: Nikolai Rodionov <allanger@badhouseplants.net> Co-committed-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit was merged in pull request #4.
This commit is contained in:
41
.woodpecker/dart-generate.yaml
Normal file
41
.woodpecker/dart-generate.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
|
||||
steps:
|
||||
- name: Clone dart repo
|
||||
image: alpine
|
||||
environment:
|
||||
GITEA_USER: devops-bot
|
||||
GITEA_TOKEN:
|
||||
from_secret: gitea_repo_access
|
||||
commands:
|
||||
- apk update && apk add git
|
||||
- git clone https://$GITEA_USER:$GITEA_TOKEN@gitea.badhouseplants.net/softplayer/softplayer-dart-proto.git target
|
||||
- git -C ./target config user.name "devops-bot"
|
||||
- git -C ./target config user.email "bot@badhouseplants.net"
|
||||
- git -C ./target checkout $CI_COMMIT_BRANCH || git -C ./target checkout -b $CI_COMMIT_BRANCH
|
||||
- name: Generate code
|
||||
image: bufbuild/buf
|
||||
commands:
|
||||
- buf generate
|
||||
- rm -rf ./target/lib/src
|
||||
- mkdir -p ./target/lib/src
|
||||
- cp -r ./gen/dart/* ./target/
|
||||
- name: Push the dart repo
|
||||
image: alpine
|
||||
environment:
|
||||
GITEA_USER: devops-bot
|
||||
GITEA_TOKEN:
|
||||
from_secret: gitea_repo_access
|
||||
commands:
|
||||
- apk update && apk add git
|
||||
- git -C ./target add .
|
||||
- |-
|
||||
git -C ./target commit --allow-empty \
|
||||
-m "Update protobuf definitions: ${CI_COMMIT_SHA:0:8}" \
|
||||
-m "By ${CI_COMMIT_AUTHOR}" \
|
||||
-m "Commit link: ${CI_REPO_URL}/commit/${CI_COMMIT_SHA}" \
|
||||
-m "Pipeline link: ${CI_PIPELINE_URL}"
|
||||
- git -C ./target push --set-upstream origin $CI_COMMIT_BRANCH
|
||||
@@ -15,7 +15,8 @@ steps:
|
||||
- git clone https://$GITEA_USER:$GITEA_TOKEN@gitea.badhouseplants.net/softplayer/softplayer-go-proto.git target
|
||||
- git -C ./target config user.name "devops-bot"
|
||||
- git -C ./target config user.email "bot@badhouseplants.net"
|
||||
- name: Generate go code
|
||||
- git -C ./target checkout $CI_COMMIT_BRANCH || git -C ./target checkout -b $CI_COMMIT_BRANCH
|
||||
- name: Generate code
|
||||
image: bufbuild/buf
|
||||
commands:
|
||||
- buf generate
|
||||
@@ -29,9 +30,6 @@ steps:
|
||||
from_secret: gitea_repo_access
|
||||
commands:
|
||||
- apk update && apk add git
|
||||
- git config user.name "woodpecker-ci"
|
||||
- git config user.email "bot@badhouseplants.net"
|
||||
- git -C ./target checkout $CI_COMMIT_BRANCH || git -C ./target checkout -b $CI_COMMIT_BRANCH
|
||||
- git -C ./target add .
|
||||
- |-
|
||||
git -C ./target commit --allow-empty \
|
||||
|
||||
@@ -15,13 +15,15 @@ steps:
|
||||
- git clone https://$GITEA_USER:$GITEA_TOKEN@gitea.badhouseplants.net/softplayer/softplayer-js-proto.git target
|
||||
- git -C ./target config user.name "devops-bot"
|
||||
- git -C ./target config user.email "bot@badhouseplants.net"
|
||||
- name: Generate go code
|
||||
- git -C ./target checkout $CI_COMMIT_BRANCH || git -C ./target checkout -b $CI_COMMIT_BRANCH
|
||||
- name: Generate code
|
||||
image: bufbuild/buf
|
||||
commands:
|
||||
- buf generate
|
||||
- rm -rf ./target/src/api
|
||||
- mkdir -p ./target/src/api
|
||||
- cp -r ./gen/ts/* ./target/src/api
|
||||
- name: Clone go repo
|
||||
- name: Push the typescript repo
|
||||
image: alpine
|
||||
environment:
|
||||
GITEA_USER: devops-bot
|
||||
@@ -29,9 +31,6 @@ steps:
|
||||
from_secret: gitea_repo_access
|
||||
commands:
|
||||
- apk update && apk add git
|
||||
- git config user.name "woodpecker-ci"
|
||||
- git config user.email "bot@badhouseplants.net"
|
||||
- git -C ./target checkout $CI_COMMIT_BRANCH || git -C ./target checkout -b $CI_COMMIT_BRANCH
|
||||
- git -C ./target add .
|
||||
- |-
|
||||
git -C ./target commit --allow-empty \
|
||||
|
||||
210
README.md
210
README.md
@@ -4,16 +4,17 @@
|
||||
## Table of Contents
|
||||
|
||||
- [accounts/v1/accounts_v1.proto](#accounts_v1_accounts_v1-proto)
|
||||
- [AccountData](#accounts-AccountData)
|
||||
- [AccountFull](#accounts-AccountFull)
|
||||
- [AccountFullWithToken](#accounts-AccountFullWithToken)
|
||||
- [AccountId](#accounts-AccountId)
|
||||
- [AccountPassword](#accounts-AccountPassword)
|
||||
- [AccountWithPassword](#accounts-AccountWithPassword)
|
||||
- [AccountWithPasswordAndCode](#accounts-AccountWithPasswordAndCode)
|
||||
- [EmailVerified](#accounts-EmailVerified)
|
||||
- [AccountData](#accounts-v1-AccountData)
|
||||
- [AccountPassword](#accounts-v1-AccountPassword)
|
||||
- [IsEmailVerifiedRequest](#accounts-v1-IsEmailVerifiedRequest)
|
||||
- [IsEmailVerifiedResponse](#accounts-v1-IsEmailVerifiedResponse)
|
||||
- [NewPasswordRequest](#accounts-v1-NewPasswordRequest)
|
||||
- [ResetPasswordRequest](#accounts-v1-ResetPasswordRequest)
|
||||
- [SignInRequest](#accounts-v1-SignInRequest)
|
||||
- [SignUpRequest](#accounts-v1-SignUpRequest)
|
||||
|
||||
- [Accounts](#accounts-Accounts)
|
||||
- [AccountAuthService](#accounts-v1-AccountAuthService)
|
||||
- [AccountsNoAuthService](#accounts-v1-AccountsNoAuthService)
|
||||
|
||||
- [applications/v1/applications_v1.proto](#applications_v1_applications_v1-proto)
|
||||
- [ApplicationFull](#applications-ApplicationFull)
|
||||
@@ -63,7 +64,8 @@
|
||||
- [PongRequest](#test-v1-PongRequest)
|
||||
- [PongResponse](#test-v1-PongResponse)
|
||||
|
||||
- [TestService](#test-v1-TestService)
|
||||
- [TestAuthService](#test-v1-TestAuthService)
|
||||
- [TestNoAuthService](#test-v1-TestNoAuthService)
|
||||
|
||||
- [Scalar Value Types](#scalar-value-types)
|
||||
|
||||
@@ -73,10 +75,10 @@
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
## accounts/v1/accounts_v1.proto
|
||||
This file has messages for describing environments
|
||||
Protobuf definitions for the accounts service.
|
||||
|
||||
|
||||
<a name="accounts-AccountData"></a>
|
||||
<a name="accounts-v1-AccountData"></a>
|
||||
|
||||
### AccountData
|
||||
|
||||
@@ -92,55 +94,7 @@ This file has messages for describing environments
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountFull"></a>
|
||||
|
||||
### AccountFull
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [AccountId](#accounts-AccountId) | | |
|
||||
| data | [AccountData](#accounts-AccountData) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountFullWithToken"></a>
|
||||
|
||||
### AccountFullWithToken
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [AccountId](#accounts-AccountId) | | |
|
||||
| data | [AccountData](#accounts-AccountData) | | |
|
||||
| token | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountId"></a>
|
||||
|
||||
### AccountId
|
||||
Represents a environment UUID only
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | Contour ID: UUID |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountPassword"></a>
|
||||
<a name="accounts-v1-AccountPassword"></a>
|
||||
|
||||
### AccountPassword
|
||||
|
||||
@@ -155,42 +109,24 @@ Represents a environment UUID only
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountWithPassword"></a>
|
||||
<a name="accounts-v1-IsEmailVerifiedRequest"></a>
|
||||
|
||||
### AccountWithPassword
|
||||
### IsEmailVerifiedRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-AccountData) | | |
|
||||
| password | [AccountPassword](#accounts-AccountPassword) | | |
|
||||
| data | [AccountData](#accounts-v1-AccountData) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-AccountWithPasswordAndCode"></a>
|
||||
<a name="accounts-v1-IsEmailVerifiedResponse"></a>
|
||||
|
||||
### AccountWithPasswordAndCode
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-AccountData) | | |
|
||||
| password | [AccountPassword](#accounts-AccountPassword) | | |
|
||||
| code | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-EmailVerified"></a>
|
||||
|
||||
### EmailVerified
|
||||
### IsEmailVerifiedResponse
|
||||
|
||||
|
||||
|
||||
@@ -202,6 +138,70 @@ Represents a environment UUID only
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-v1-NewPasswordRequest"></a>
|
||||
|
||||
### NewPasswordRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-v1-AccountData) | | |
|
||||
| password | [AccountPassword](#accounts-v1-AccountPassword) | | |
|
||||
| code | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-v1-ResetPasswordRequest"></a>
|
||||
|
||||
### ResetPasswordRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-v1-AccountData) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-v1-SignInRequest"></a>
|
||||
|
||||
### SignInRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-v1-AccountData) | | |
|
||||
| password | [AccountPassword](#accounts-v1-AccountPassword) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="accounts-v1-SignUpRequest"></a>
|
||||
|
||||
### SignUpRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| data | [AccountData](#accounts-v1-AccountData) | | |
|
||||
| password | [AccountPassword](#accounts-v1-AccountPassword) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -209,18 +209,29 @@ Represents a environment UUID only
|
||||
|
||||
|
||||
|
||||
<a name="accounts-Accounts"></a>
|
||||
<a name="accounts-v1-AccountAuthService"></a>
|
||||
|
||||
### Accounts
|
||||
Service for handling environments
|
||||
### AccountAuthService
|
||||
Service for handling accounts that do require authentication
|
||||
Tokens should be sent via metadata, so the service is able to authenticate a user for a request
|
||||
|
||||
| Method Name | Request Type | Response Type | Description |
|
||||
| ----------- | ------------ | ------------- | ------------|
|
||||
| SignUp | [AccountWithPassword](#accounts-AccountWithPassword) | [AccountFullWithToken](#accounts-AccountFullWithToken) | |
|
||||
| SignIn | [AccountWithPassword](#accounts-AccountWithPassword) | [AccountFullWithToken](#accounts-AccountFullWithToken) | |
|
||||
| ResetPassword | [AccountData](#accounts-AccountData) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
||||
| NewPassword | [AccountWithPasswordAndCode](#accounts-AccountWithPasswordAndCode) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
||||
| IsEmailVerified | [AccountData](#accounts-AccountData) | [EmailVerified](#accounts-EmailVerified) | |
|
||||
| IsEmailVerified | [IsEmailVerifiedRequest](#accounts-v1-IsEmailVerifiedRequest) | [IsEmailVerifiedResponse](#accounts-v1-IsEmailVerifiedResponse) | Is email for the current account verified |
|
||||
|
||||
|
||||
<a name="accounts-v1-AccountsNoAuthService"></a>
|
||||
|
||||
### AccountsNoAuthService
|
||||
Service for handling accounts that do not require authentication
|
||||
|
||||
| Method Name | Request Type | Response Type | Description |
|
||||
| ----------- | ------------ | ------------- | ------------|
|
||||
| SignUp | [SignUpRequest](#accounts-v1-SignUpRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Create a new user |
|
||||
| SignIn | [SignInRequest](#accounts-v1-SignInRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Sing in into an existing account |
|
||||
| ResetPassword | [ResetPasswordRequest](#accounts-v1-ResetPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Reset the password, if it was lost |
|
||||
| NewPassword | [NewPasswordRequest](#accounts-v1-NewPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Set the new password after reset |
|
||||
| RefreshToken | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | Send the refresh token request, token should be passed in the metadata. This rpc does requier auth, but it should be handled not on the middleware level, that's why it set in the NoAuth service |
|
||||
|
||||
|
||||
|
||||
@@ -844,15 +855,24 @@ Service for handling environments
|
||||
|
||||
|
||||
|
||||
<a name="test-v1-TestService"></a>
|
||||
<a name="test-v1-TestAuthService"></a>
|
||||
|
||||
### TestService
|
||||
### TestAuthService
|
||||
|
||||
|
||||
| Method Name | Request Type | Response Type | Description |
|
||||
| ----------- | ------------ | ------------- | ------------|
|
||||
| Pong | [PongRequest](#test-v1-PongRequest) | [PongResponse](#test-v1-PongResponse) | |
|
||||
|
||||
|
||||
<a name="test-v1-TestNoAuthService"></a>
|
||||
|
||||
### TestNoAuthService
|
||||
Service for handling environments
|
||||
|
||||
| Method Name | Request Type | Response Type | Description |
|
||||
| ----------- | ------------ | ------------- | ------------|
|
||||
| Ping | [PingRequest](#test-v1-PingRequest) | [PingResponse](#test-v1-PingResponse) | |
|
||||
| Pong | [PongRequest](#test-v1-PongRequest) | [PongResponse](#test-v1-PongResponse) | |
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,3 +20,7 @@ plugins:
|
||||
out: .
|
||||
opt:
|
||||
- markdown,README.md
|
||||
- remote: buf.build/protocolbuffers/dart:v25.0.0
|
||||
out: gen/dart/lib/src
|
||||
opt:
|
||||
- grpc
|
||||
|
||||
8
buf.yaml
8
buf.yaml
@@ -1,3 +1,11 @@
|
||||
version: v2
|
||||
modules:
|
||||
- path: proto
|
||||
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
enum_zero_value_suffix: _UNSPECIFIED
|
||||
rpc_allow_same_request_response: true
|
||||
rpc_allow_google_protobuf_empty_requests: true
|
||||
rpc_allow_google_protobuf_empty_responses: true
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
/// This file has messages for describing environments
|
||||
/// Protobuf definitions for the accounts service.
|
||||
syntax = "proto3";
|
||||
package accounts;
|
||||
package accounts.v1;
|
||||
import "google/protobuf/empty.proto";
|
||||
option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts";
|
||||
option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1";
|
||||
|
||||
/**
|
||||
* Service for handling environments
|
||||
* Service for handling accounts that do not require authentication
|
||||
*/
|
||||
service Accounts {
|
||||
rpc SignUp (AccountWithPassword) returns (AccountFullWithToken) {}
|
||||
rpc SignIn (AccountWithPassword) returns (AccountFullWithToken) {}
|
||||
rpc ResetPassword (AccountData) returns (google.protobuf.Empty) {}
|
||||
rpc NewPassword (AccountWithPasswordAndCode) returns (google.protobuf.Empty) {}
|
||||
rpc IsEmailVerified (AccountData) returns (EmailVerified) {}
|
||||
service AccountsNoAuthService {
|
||||
// Sing in into an existing account
|
||||
rpc SignIn (SignInRequest) returns (google.protobuf.Empty) {}
|
||||
}
|
||||
|
||||
message EmailVerified {
|
||||
bool verified = 1;
|
||||
}
|
||||
/**
|
||||
* Represents a environment UUID only
|
||||
* Service for handling accounts that do require authentication
|
||||
* Tokens should be sent via metadata, so the service is able to authenticate a user for a request
|
||||
*/
|
||||
message AccountId {
|
||||
string id = 1; // Contour ID: UUID
|
||||
service AccountsAuthService {
|
||||
// Is email for the current account verified
|
||||
rpc IsEmailVerified (IsEmailVerifiedRequest) returns (IsEmailVerifiedResponse) {}
|
||||
rpc RefreshToken (google.protobuf.Empty) returns (google.protobuf.Empty) {}
|
||||
}
|
||||
|
||||
message AccountPassword {
|
||||
string password = 1;
|
||||
}
|
||||
|
||||
|
||||
message AccountData {
|
||||
string name = 1; // Account name
|
||||
string email = 2; // Account email
|
||||
}
|
||||
|
||||
message AccountWithPassword {
|
||||
message SignUpRequest {
|
||||
AccountData data = 1;
|
||||
AccountPassword password = 2;
|
||||
}
|
||||
|
||||
message AccountWithPasswordAndCode {
|
||||
message SignInRequest {
|
||||
string code = 1;
|
||||
string verifier = 2;
|
||||
};
|
||||
|
||||
message ResetPasswordRequest {
|
||||
AccountData data = 1;
|
||||
}
|
||||
|
||||
message NewPasswordRequest {
|
||||
AccountData data = 1;
|
||||
AccountPassword password = 2;
|
||||
string code = 3;
|
||||
}
|
||||
|
||||
|
||||
message AccountFull {
|
||||
AccountId id = 1;
|
||||
AccountData data = 2;
|
||||
message IsEmailVerifiedRequest {
|
||||
AccountData data = 1;
|
||||
}
|
||||
|
||||
message AccountFullWithToken {
|
||||
AccountId id = 1;
|
||||
AccountData data = 2;
|
||||
string token = 3;
|
||||
message IsEmailVerifiedResponse {
|
||||
bool verified = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg
|
||||
/**
|
||||
* Service for handling environments
|
||||
*/
|
||||
service TestService {
|
||||
service TestNoAuthService {
|
||||
rpc Ping (PingRequest) returns (PingResponse) {}
|
||||
}
|
||||
|
||||
service TestAuthService {
|
||||
rpc Pong (PongRequest) returns (PongResponse) {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user