foodsoft/swagger/v1/swagger.yaml

170 lines
5.2 KiB
YAML
Raw Normal View History

2022-11-07 12:23:54 +01:00
---
openapi: 3.0.1
info:
title: API V1
version: v1
paths:
"/user":
get:
summary: info about the currently logged-in user
tags:
2022-11-07 17:42:32 +01:00
- User
2022-11-07 12:23:54 +01:00
responses:
'200':
description: success
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
type: object
properties:
user:
type: object
properties:
id:
type: integer
name:
type: string
description: full name
email:
type: string
description: email address
locale:
type: string
description: language code
required:
- id
- name
- email
2022-11-07 17:42:32 +01:00
'401':
description: not logged-in
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
"$ref": "#/components/schemas/Error401"
2022-11-07 13:41:39 +01:00
'403':
description: missing scope
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
"$ref": "#/components/schemas/Error403"
2022-11-07 17:42:32 +01:00
"/user/financial_overview":
get:
summary: financial summary about the currently logged-in user
tags:
- User
- FinancialTransaction
responses:
'200':
description: success
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
type: object
properties:
account_balance:
type: number
description: booked accout balance of ordergroup
available_funds:
type: number
description: fund available to order articles
financial_transaction_class_sums:
type: object
properties:
id:
type: integer
description: id of the financial transaction class
name:
type: string
description: name of the financial transaction class
amount:
type: number
description: sum of the amounts belonging to the financial
transaction class
required:
- id
- name
- amount
required:
- account_balance
- available_funds
- financial_transaction_class_sums
2022-11-07 12:23:54 +01:00
'401':
description: not logged-in
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
"$ref": "#/components/schemas/Error401"
2022-11-07 17:42:32 +01:00
'403':
description: missing scope
2022-11-21 12:49:53 +01:00
content:
application/json:
schema:
"$ref": "#/components/schemas/Error403"
2022-11-07 12:23:54 +01:00
components:
2022-11-21 12:49:53 +01:00
schemas:
Error:
type: object
properties:
error:
type: string
description: error code
error_description:
type: string
description: human-readable error message (localized)
Error401:
type: object
properties:
error:
type: string
description: "<tt>unauthorized</tt>"
error_description:
"$ref": "#/components/schemas/Error/properties/error_description"
Error403:
type: object
properties:
error:
type: string
description: "<tt>forbidden</tt> or <tt>invalid_scope</tt>"
error_description:
"$ref": "#/components/schemas/Error/properties/error_description"
Error404:
type: object
properties:
error:
type: string
description: "<tt>not_found</tt>"
error_description:
"$ref": "#/components/schemas/Error/properties/error_description"
Error422:
type: object
properties:
error:
type: string
description: unprocessable entity
error_description:
"$ref": "#/components/schemas/Error/properties/error_description"
2022-11-07 12:23:54 +01:00
securitySchemes:
oauth2:
type: oauth2
flows:
implicit:
authorizationUrl: http://localhost:3000/f/oauth/authorize
scopes:
config:user: reading Foodsoft configuration for regular users
config:read: reading Foodsoft configuration values
config:write: reading and updating Foodsoft configuration values
finance:user: accessing your own financial transactions
finance:read: reading all financial transactions
finance:write: reading and creating financial transactions
user:read: reading your own user profile
user:write: reading and updating your own user profile
offline_access: retain access after user has logged out
servers:
- url: http://{defaultHost}/f/api/v1
variables:
defaultHost:
default: localhost:3000
security:
- oauth2:
- user:read