Skip to content

Commit

Permalink
Merge branch 'main' into feat/users-user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
tosaken1116 committed Apr 6, 2024
2 parents a5147eb + 41958ee commit 5a5e454
Show file tree
Hide file tree
Showing 15 changed files with 501 additions and 20 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/resolve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: rebase and rebuild openapi

on:
workflow_dispatch:

jobs:
rebase_and_rebuild_openapi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Rebase
run: git rebase main
- name: Rebuild OpenAPI
run: |
make build
- name: Commit and push
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<[email protected]>"
git add .
git commit -m "Rebuild OpenAPI"
git push
169 changes: 167 additions & 2 deletions openapi/api_definition.swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
swagger: "2.0"
info:
title: proto/schema/auth/discord/callback/callback.proto
title: proto/schema/tags/tags.proto
version: version not set
tags:
- name: TagsService
- name: TokenService
- name: DiscordService
- name: SignUpService
- name: DiscordCallbackService
- name: UserService
- name: TagsService
- name: MeService
consumes:
- application/json
produces:
- application/json
paths:
/v1/auth/discord:
post:
operationId: DiscordService_GetDiscord
responses:
"200":
description: A successful response.
schema:
type: string
"422":
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
tags:
- DiscordService
/v1/auth/discord/callback:
get:
operationId: DiscordCallbackService_GetDiscordCallback
Expand All @@ -37,6 +62,74 @@ paths:
type: string
tags:
- DiscordCallbackService
/v1/auth/sign_up:
post:
operationId: SignUpService_PostSignUp
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/resourcesAccount'
"422":
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
parameters:
- name: name
in: query
required: false
type: string
- name: email
in: query
required: false
type: string
- name: password
in: query
required: false
type: string
- name: display_name
in: query
required: false
type: string
- name: avatar_url
in: query
required: false
type: string
tags:
- SignUpService
/v1/auth/token:
post:
operationId: TokenService_PostToken
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/rpcPostTokenResponse'
"422":
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
parameters:
- name: refresh_token
in: query
required: false
type: string
tags:
- TokenService
/v1/tags:
get:
operationId: TagsService_GetTags
Expand Down Expand Up @@ -76,6 +169,53 @@ paths:
type: string
tags:
- TagsService
/v1/users/@me:
get:
operationId: MeService_GetMe
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/resourcesAccount'
"422":
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
tags:
- MeService
put:
operationId: MeService_PutMe
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/resourcesAccount'
"422":
description: Validation Error
schema: {}
examples:
application/json:
detail:
- loc:
- string
- 0
msg: string
type: string
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/rpcAccountPatcher'
tags:
- MeService
/v1/users/{user_id}:
get:
operationId: UserService_GetUser
Expand Down Expand Up @@ -148,6 +288,22 @@ definitions:
type: string
expired_at:
type: string
rpcAccountPatcher:
type: object
example:
display_name: string
github_id: string
profile: string
twitter_id: string
properties:
display_name:
type: string
profile:
type: string
twitter_id:
type: string
github_id:
type: string
rpcGetTagsResponse:
type: object
properties:
Expand All @@ -156,6 +312,15 @@ definitions:
items:
type: object
$ref: '#/definitions/tagsresourcesTag'
rpcPostTokenResponse:
type: object
properties:
expired_at:
type: string
refresh_token:
type: string
access_token:
type: string
tagsresourcesTag:
type: object
example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@ syntax = "proto3";

package proto.schema.auth.discord.callback;

import "proto/schema/auth/discord/callback/rpc/callback.proto";
import "proto/schema/auth/discord/callback/resources/callback.proto";
import "proto/schema/auth/discord-callback/rpc/callback.proto";
import "proto/schema/auth/discord-callback/resources/callback.proto";

import "proto/third_party/google/api/annotations.proto";
import "proto/third_party/grpc/openapiv2/options/annotations.proto";
option go_package = "./";

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
responses : {key : "422";
value : {
description:
"Validation Error" examples : {
key:
"application/json" value : "{\"detail\":[{\"loc\":[\"string\",0],\"msg\":"
"\"string\",\"type\":\"string\"}]}"
}
}
}
}
;
option go_package = "./";

message ErrorResponse {
int32 status = 1;
Expand Down
17 changes: 17 additions & 0 deletions proto/schema/auth/discord/discord.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package proto.schema.auth.discord;

import "proto/third_party/google/api/annotations.proto";
import "proto/third_party/google/api/empty.proto";
import "proto/third_party/google/api/wrappers.proto";

option go_package = "./";

service DiscordService {
rpc GetDiscord(google.protobuf.Empty) returns (google.protobuf.StringValue) {
option (google.api.http) = {
post : "/v1/auth/discord"
};
};
}
13 changes: 13 additions & 0 deletions proto/schema/auth/sign_up/resources/signup.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package proto.schema.auth.sign_up.resources;

option go_package = "./";

message InitialAccountTemplate {
string name = 1;
string email = 2;
string password = 3;
string display_name = 4;
string avatar_url = 5;
}
19 changes: 19 additions & 0 deletions proto/schema/auth/sign_up/signup.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

package proto.schema.auth.sign_up;

import "proto/schema/auth/sign_up/resources/signup.proto";
import "proto/schema/users/me/resources/me.proto";

import "proto/third_party/google/api/annotations.proto";

option go_package = "./";

service SignUpService {
rpc PostSignUp(proto.schema.auth.sign_up.resources.InitialAccountTemplate)
returns (proto.schema.users.me.resources.Account) {
option (google.api.http) = {
post : "/v1/auth/sign_up"
};
};
}
13 changes: 13 additions & 0 deletions proto/schema/auth/token/rpc/token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package proto.schema.auth.token.rpc;

option go_package = "./";

message PostTokenRequest { string refresh_token = 1; }

message PostTokenResponse {
string expired_at = 1;
string refresh_token = 2;
string access_token = 3;
}
17 changes: 17 additions & 0 deletions proto/schema/auth/token/token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package proto.token;

import "proto/schema/auth/token/rpc/token.proto";
import "proto/third_party/google/api/annotations.proto";

option go_package = "./";

service TokenService {
rpc PostToken(proto.schema.auth.token.rpc.PostTokenRequest)
returns (proto.schema.auth.token.rpc.PostTokenResponse) {
option (google.api.http) = {
post : "/v1/auth/token"
};
};
}
28 changes: 28 additions & 0 deletions proto/schema/users/me/me.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package proto.schema.users.me;

import "proto/schema/users/me/resources/me.proto";
import "proto/schema/users/me/rpc/me.proto";

import "proto/third_party/google/api/empty.proto";
import "proto/third_party/google/api/annotations.proto";

option go_package = "./";

service MeService {
rpc GetMe(google.protobuf.Empty)
returns (proto.schema.users.me.resources.Account) {
option (google.api.http) = {
get : "/v1/users/@me"
};
};

rpc PutMe(proto.schema.users.me.rpc.AccountPatcher)
returns (proto.schema.users.me.resources.Account) {
option (google.api.http) = {
put : "/v1/users/@me"
body : "*"
};
};
}
2 changes: 1 addition & 1 deletion proto/schema/users/me/resources/me.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ message Account {
"\"updated_at\": \"2024-01-11T07:56:02.206Z\""
"}"
};
}
}
Loading

0 comments on commit 5a5e454

Please sign in to comment.