Advertisement
kwandes

Giftshop Swaggerjs manual doc

Sep 25th, 2022 (edited)
991
0
302 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 10.72 KB | None | 0 0
  1. openapi: 3.0.3
  2. info:
  3.   title: TBD
  4.   description: TBD
  5.   version: 1.0.11
  6. externalDocs:
  7.   description: System Architecture diagram
  8.   url: https://whimsical.com/system-architecture-SrQSovAnPJn3YRMLCA9L43
  9. servers:
  10.   - url: https://tbd.hotdeals.dev
  11. tags:
  12.   - name: Authentication
  13.   - name: Friends
  14.     description: Invites and status of your friends
  15.   - name: Products
  16.     description: Upload and get products
  17.   - name: Profile
  18.     description: Profile related activities
  19. paths:
  20.   /auth/login:
  21.     post:
  22.       tags:
  23.        - Authentication
  24.       summary: Log in as a pre-existing user
  25.       description: Log in and get an access token for your user
  26.       operationId: login
  27.       requestBody:
  28.         description: User information
  29.         content:
  30.           application/json:
  31.             schema:
  32.               $ref: '#/components/schemas/Login'
  33.           application/xml:
  34.             schema:
  35.               $ref: '#/components/schemas/Login'
  36.           application/x-www-form-urlencoded:
  37.             schema:
  38.               $ref: '#/components/schemas/Login'
  39.         required: true
  40.       responses:
  41.         '200':
  42.           description: Successful login
  43.           content:
  44.             application/json:
  45.               schema:
  46.                 $ref: '#/components/schemas/AccessToken'          
  47.             application/xml:
  48.               schema:
  49.                 $ref: '#/components/schemas/AccessToken'
  50.         '400':
  51.           description: Missing request body information
  52.         '401':
  53.           description: Invalid credentials
  54.   /auth/signup:
  55.     post:
  56.       tags:
  57.        - Authentication
  58.       summary: Sign up as a new user
  59.       description: Sign up and get an access token for your new user
  60.       operationId: signup
  61.       requestBody:
  62.         description: User information
  63.         content:
  64.           application/json:
  65.             schema:
  66.               $ref: '#/components/schemas/Login'
  67.           application/xml:
  68.             schema:
  69.               $ref: '#/components/schemas/Login'
  70.           application/x-www-form-urlencoded:
  71.             schema:
  72.               $ref: '#/components/schemas/Login'
  73.         required: true
  74.       responses:
  75.         '200':
  76.           description: Successful signup
  77.           content:
  78.             application/json:
  79.               schema:
  80.                 $ref: '#/components/schemas/AccessToken'          
  81.             application/xml:
  82.               schema:
  83.                 $ref: '#/components/schemas/AccessToken'
  84.         '400':
  85.           description: Missing request body information OR the provded email is already used
  86.         '401':
  87.           description: Invalid credentials
  88.   /graphql:
  89.     get:
  90.       tags:
  91.        - Products
  92.       summary: Get a list of all products
  93.       operationId: getProducts
  94.       parameters:
  95.         - name: minPrice
  96.           in: query
  97.           description: Minimum price of the gift
  98.           required: false
  99.           schema:
  100.             type: number
  101.             example: 0
  102.         - name: maxPrice
  103.           in: query
  104.           description: Maximum price of the gift
  105.           required: false
  106.           schema:
  107.             type: number
  108.             example: 100
  109.       responses:
  110.         '200':
  111.           description: A list of all products
  112.           content:
  113.             application/json:
  114.               schema:
  115.                 $ref: '#/components/schemas/TBD'          
  116.             application/xml:
  117.               schema:
  118.                 $ref: '#/components/schemas/TBD'
  119.       security:
  120.         - auth:
  121.           - user
  122.            - admin
  123.     post:
  124.       tags:
  125.        - Products
  126.       summary: Create a new products
  127.       description: Create a new products and add it tot he lsit fo existing ones
  128.       operationId: createProduct
  129.       responses:
  130.         '200':
  131.           description: Created Product
  132.           content:
  133.             application/json:
  134.               schema:
  135.                 $ref: '#/components/schemas/TBD'          
  136.             application/xml:
  137.               schema:
  138.                 $ref: '#/components/schemas/TBD'
  139.       security:
  140.         - auth:
  141.           - user
  142.            - admin
  143.   /graphql/{productId}:
  144.     get:
  145.       tags:
  146.        - Products
  147.       summary: Get a specific product
  148.       operationId: getProductById
  149.       parameters:
  150.         - name: productId
  151.           in: path
  152.           description: ID of the product to update
  153.           required: true
  154.           schema:
  155.             type: integer
  156.             format: int64
  157.       responses:
  158.         '200':
  159.           description: A product
  160.           content:
  161.             application/json:
  162.               schema:
  163.                 $ref: '#/components/schemas/TBD'          
  164.             application/xml:
  165.               schema:
  166.                 $ref: '#/components/schemas/TBD'
  167.       security:
  168.         - auth:
  169.           - user
  170.            - admin
  171.     put:
  172.       tags:
  173.        - Products
  174.       summary: Update an existing product
  175.       description: Create a new products and add it to the list of existing ones
  176.       operationId: updateProduct
  177.       parameters:
  178.         - name: productId
  179.           in: path
  180.           description: ID of the product to update
  181.           required: true
  182.           schema:
  183.             type: integer
  184.             format: int64
  185.       requestBody:
  186.         description: New product information
  187.         content:
  188.           application/json:
  189.             schema:
  190.               $ref: '#/components/schemas/TBD'
  191.           application/xml:
  192.             schema:
  193.               $ref: '#/components/schemas/TBD'
  194.           application/x-www-form-urlencoded:
  195.             schema:
  196.               $ref: '#/components/schemas/TBD'
  197.         required: true
  198.       responses:
  199.         '200':
  200.           description: Updated Product
  201.           content:
  202.             application/json:
  203.               schema:
  204.                 $ref: '#/components/schemas/TBD'          
  205.             application/xml:
  206.               schema:
  207.                 $ref: '#/components/schemas/TBD'
  208.         '400':
  209.           description: Missing or invalid request body information
  210.         '404':
  211.           description: Product not found
  212.       security:
  213.         - auth:
  214.           - user
  215.            - admin
  216.     delete:
  217.       tags:
  218.        - Products
  219.       summary: Delete an existing product
  220.       description: Delete a product
  221.       operationId: deleteProduct
  222.       parameters:
  223.         - name: productId
  224.           in: path
  225.           description: ID of the product to update
  226.           required: true
  227.           schema:
  228.             type: integer
  229.             format: int64
  230.       responses:
  231.         '202':
  232.           description: Product deleted
  233.         '400':
  234.           description: Missing or invalid request body information
  235.         '404':
  236.           description: Product not found
  237.       security:
  238.         - auth:
  239.           - user
  240.            - admin
  241.   /friends/invite:
  242.     post:
  243.       tags:
  244.        - Friends
  245.       summary: Create an invite and send it to your friend
  246.       operationId: inviteFriend
  247.       requestBody:
  248.         description: Friend information
  249.         content:
  250.           application/json:
  251.             schema:
  252.               $ref: '#/components/schemas/Invite'
  253.           application/xml:
  254.             schema:
  255.               $ref: '#/components/schemas/Invite'
  256.           application/x-www-form-urlencoded:
  257.             schema:
  258.               $ref: '#/components/schemas/Invite'
  259.         required: true
  260.       responses:
  261.         '202':
  262.           description: Friend has been invited and an email has been sent
  263.       security:
  264.         - auth:
  265.           - user
  266.            - admin
  267.   /friends/accept-invite/{token}:
  268.     put:
  269.       tags:
  270.        - Friends
  271.       summary: Create an invite and send it to your friend
  272.       operationId: acceptInvite
  273.       parameters:
  274.         - name: token
  275.           in: path
  276.           description: token of the invitee
  277.           required: true
  278.           schema:
  279.             type: string
  280.       requestBody:
  281.         description: Information to be used for the new user
  282.         content:
  283.           application/json:
  284.             schema:
  285.               $ref: '#/components/schemas/Login'
  286.           application/xml:
  287.             schema:
  288.               $ref: '#/components/schemas/Login'
  289.           application/x-www-form-urlencoded:
  290.             schema:
  291.               $ref: '#/components/schemas/Login'
  292.         required: true
  293.       responses:
  294.         '200':
  295.           description: Successful login
  296.           content:
  297.             application/json:
  298.               schema:
  299.                 $ref: '#/components/schemas/AccessToken'          
  300.             application/xml:
  301.               schema:
  302.                 $ref: '#/components/schemas/AccessToken'
  303.         '400':
  304.           description: Missing request body information
  305.         '403':
  306.           description: Invalid token
  307.   /friends/status:
  308.     get:
  309.       tags:
  310.        - Friends
  311.       summary: Get a list of all invites
  312.       operationId: getInvites
  313.       responses:
  314.         '200':
  315.           description: A list of all invites
  316.           content:
  317.             application/json:
  318.               schema:
  319.                 $ref: '#/components/schemas/TBD'          
  320.             application/xml:
  321.               schema:
  322.                 $ref: '#/components/schemas/TBD'
  323.       security:
  324.         - auth:
  325.           - user
  326.            - admin
  327.   /profile-picture/update:
  328.     post:
  329.       tags:
  330.        - Profile
  331.       summary: Update the profile picture
  332.       description: Update the profile picture of the currently signed in user
  333.       operationId: updateProfilePicture
  334.       requestBody:
  335.         content:
  336.           application/octet-stream:
  337.             schema:
  338.               type: string
  339.               format: binary
  340.       responses:
  341.         '202':
  342.           description: profile picture updated
  343.       security:
  344.         - auth:
  345.           - user
  346.            - admin
  347. components:
  348.   schemas:
  349.     Login:
  350.       required:
  351.        - email
  352.         - password
  353.       type: object
  354.       properties:
  355.         email:
  356.           type: string
  357.           example: example@email.com
  358.         password:
  359.           type: string
  360.     AccessToken:
  361.       type: object
  362.       properties:
  363.         accessToken:
  364.           type: string
  365.           example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJoZWxsbyBUaGVyZSI6IkdlbmVyYWwgS2Vub2JpIn0.v34MZjT9muobaJFfrpGKGRDg19L5MK3X_KGENDYg4n4
  366.     TBD:
  367.       type: array
  368.       items: {}
  369.       example: []
  370.     Invite:
  371.       type: object
  372.       properties:
  373.         email:
  374.           type: string
  375.           example: example@email.com
  376.   securitySchemes:
  377.     auth:
  378.       type: oauth2
  379.       flows:
  380.         implicit:
  381.           authorizationUrl: https://tbd.hotdeals.dev/auth/login
  382.           scopes:
  383.             user: have a user role
  384.             admin: have an admin role
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement