diff --git a/api/auth/api.yaml b/api/auth/api.yaml new file mode 100644 index 0000000..33f5654 --- /dev/null +++ b/api/auth/api.yaml @@ -0,0 +1,113 @@ +openapi: 3.0.0 +info: + title: Authentication API + version: 1.0.0 +servers: + - url: https://id.logidex.ru/api/auth +paths: + /otp/request: + post: + summary: Request OTP + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RequestOTPRequest' + + responses: + '200': + description: OTP requested successfully + content: + application/json: + schema: + $ref: '#/components/schemas/RequestOTPResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/RequestOTPResponse' + /otp/verify: + post: + summary: Verify OTP + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyOTPRequest' + responses: + '200': + description: OTP verified successfully + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyOTPResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyOTPResponse' +components: + schemas: + RequestOTPRequest: + type: object + properties: + phone_number: + type: string + description: Phone number to send OTP to + example: "+79999999999" + maxLength: 15 + required: + - phone_number + RequestOTPResponse: + type: object + properties: + message: + type: string + description: Confirmation message + example: "OTP sent successfully" + ok: + type: boolean + description: Status of the request + example: true + required: + - message + - ok + VerifyOTPRequest: + type: object + properties: + phone_number: + type: string + description: Phone number to verify OTP for + example: "+79999999999" + maxLength: 15 + otp: + type: string + description: One-time password to verify + example: "123456" + maxLength: 6 + login_challenge: + type: string + description: Login challenge for verification + example: "challenge123" + required: + - phone_number + - otp + - login_challenge + VerifyOTPResponse: + type: object + properties: + redirect_url: + type: string + description: URL to redirect to after successful verification + example: "https://example.com/redirect" + ok: + type: boolean + description: Status of the verification + example: true + required: + - redirect_url + - ok \ No newline at end of file diff --git a/api/auth/cfg.yaml b/api/auth/cfg.yaml new file mode 100644 index 0000000..c73a53e --- /dev/null +++ b/api/auth/cfg.yaml @@ -0,0 +1,6 @@ +package: handler +generate: + fiber-server: true + strict-server: true + models: true +output: gen.go \ No newline at end of file diff --git a/api/todo/todo.yaml b/api/todo/api.yaml similarity index 100% rename from api/todo/todo.yaml rename to api/todo/api.yaml diff --git a/api/user/user.yaml b/api/user/api.yaml similarity index 100% rename from api/user/user.yaml rename to api/user/api.yaml diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..7b8a4f2 --- /dev/null +++ b/config.yaml @@ -0,0 +1,10 @@ +app: + port: 8080 + +redis: + host: localhost + port: 6379 + db: 0 + +hydra: + host: https://oauth2.logidex.ru/admin \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..217a381 --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,9 @@ +openapi: 3.0.0 +info: + title: Logidex ID API + version: 1.0.0 + +paths: + /auth: + $ref: './api/auth/api.yaml#/paths' +