Advertisement
phanindhar1

milq

Feb 13th, 2022
1,231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 9.63 KB | None | 0 0
  1. swagger: '2.0'
  2. info:
  3.   description: This is a simple API
  4.   version: 1.0.0
  5.   title: Simple Inventory API
  6.   # put the contact info for your development or API team
  7.   contact:
  8.     email: you@your-company.com
  9.  
  10.   license:
  11.     name: Apache 2.0
  12.     url: http://www.apache.org/licenses/LICENSE-2.0.html
  13.  
  14. # tags are used for organizing operations
  15. tags:
  16.   - name: admins
  17.     description: Secured Admin-only calls
  18.   - name: developers
  19.     description: Operations available to regular developers
  20.   - name: users
  21.     description: opertation avilable for the users
  22. paths:
  23.   /address:
  24.     get:
  25.       tags:
  26.        - users
  27.       summary: searches address
  28.       operationId: searchInventory
  29.       description: |
  30.        By passing in the user id, you can search for
  31.         available address added by user
  32.       produces:
  33.        - application/json
  34.       parameters:
  35.         - in: query
  36.           name: userid
  37.           description: pass an userid for fetching all his address
  38.           required: true
  39.           type: string
  40.       responses:
  41.         200:
  42.           description: search results matching criteria
  43.           schema:
  44.             type: array
  45.             items:
  46.               $ref: '#/definitions/Address'
  47.         400:
  48.           description: bad input parameter
  49.     post:
  50.       tags:
  51.        - users
  52.       summary: adds an address item
  53.       operationId: addAddress
  54.       description: Adds an Address to the system
  55.       consumes:
  56.        - application/json
  57.       produces:
  58.        - application/json
  59.       parameters:
  60.         - in: body
  61.           name: inventoryItem
  62.           description: Inventory item to add
  63.           schema:
  64.             $ref: '#/definitions/Address'
  65.       responses:
  66.         201:
  67.           description: item created
  68.         400:
  69.           description: invalid input, object invalid
  70.         409:
  71.           description: an existing item already exists
  72. definitions:
  73.   Address:
  74.     type: object
  75.     required:
  76.      - house_no
  77.       - street_name
  78.       - address_line1
  79.       - address_line2
  80.       - address_line3
  81.       - landmark
  82.       - pincode
  83.       - label
  84.       - modified_at
  85.       - created_at
  86.     properties:
  87.       house_no:
  88.         type: string
  89.         example: 1-21/f
  90.       street_name:
  91.         type: string
  92.         example: Gandhi Nagar
  93.       address_line1:
  94.         type: string
  95.         example: near hps school
  96.       address_line2:
  97.         type: string
  98.         example: gouri apartments
  99.       address_line3:
  100.         type: string
  101.         example: ""
  102.       landmark:
  103.         type: string
  104.         example: HP Petrol Bunk
  105.       label:
  106.         type: string
  107.         example: GrandMom House
  108.       pincode:
  109.         type: integer
  110.         example: 500084
  111.       address_id:
  112.         type: string
  113.         example: user_add1
  114.       created_at:
  115.         type: string
  116.         example: "2017-07-21T17:32:28Z"
  117.       modified_at:
  118.         type: string
  119.         example: "2017-07-21T17:32:28Z"
  120.   Order:
  121.     type: object
  122.     required:
  123.      - id
  124.       - user_profile_id
  125.       - cart_id
  126.       - address_id
  127.       - created_at
  128.       - modified_at
  129.       - comments
  130.       - total
  131.     properties:
  132.       id:
  133.         type: string
  134.         example: abc123
  135.       user_profile_id:
  136.         type: string
  137.         example: abc123
  138.       cart_id:
  139.         type: string
  140.         example: crt123
  141.       address_line2:
  142.         type: string
  143.         example: gouri apartments
  144.       created_at:
  145.         type: string
  146.         example: "2017-07-21T17:32:28Z"
  147.       modified_at:
  148.         type: string
  149.         example: "2017-07-21T17:32:28Z"
  150.       comments:
  151.         type: string
  152.         example: Ordered for the |
  153.          family event
  154.       total:
  155.         type: number
  156.         example: 29.23
  157.   OrderItem:
  158.     type: object
  159.     required:
  160.      - id
  161.       - product_id
  162.       - quantity
  163.       - status
  164.       - delivery_date
  165.       - created_at
  166.       - modified_at
  167.       - unit_price
  168.       - total_price # total  unit price * item_price
  169.       - tax
  170.       - order_id # parent order id
  171.       - subscription_id # if any is available
  172.     properties:
  173.       id:
  174.         type : string
  175.         example : abc123
  176.       product_id:
  177.         type: string
  178.         example: abc123
  179.       created_at:
  180.         type: string
  181.         example: "2017-07-21T17:32:28Z"
  182.       modified_at:
  183.         type: string
  184.         example: "2017-07-21T17:32:28Z"
  185.       quantity:
  186.         type: integer
  187.         example: 2
  188.       unit_price:
  189.         type: number
  190.         example: 12.3
  191.       total_price:
  192.         type: number
  193.         example: 24.6
  194.       order_id:
  195.         type: string
  196.         example: ord123
  197.       tax:
  198.         type: number
  199.         example: 0.6
  200.       delivery_date:
  201.         type: string
  202.         example: "2022-02-14"
  203.       statue:
  204.         type: string
  205.         example: delivered
  206.  
  207.       subscription_id:
  208.         type: string
  209.         example: sub123
  210.  
  211.       # Added by API Auto Mocking Plugin
  212.   User:
  213.     type: object
  214.     required:
  215.      - id
  216.     properties:
  217.       id:
  218.         type: string
  219.         example: "42"
  220.   UserProfile:
  221.     type: object
  222.     required:
  223.      - id
  224.       - user_id
  225.       - phone_number
  226.       - last_used_address_id
  227.     properties:
  228.       id:
  229.         type: string
  230.         example: "42"
  231.       last_used_address_id:
  232.         type: string
  233.         example: "lad42"
  234.       name:
  235.         type: string
  236.         example: user
  237.       user_id:
  238.         type: string
  239.         example: "42"
  240.       phone_number:
  241.         type: integer
  242.         example: 916666666666
  243.       email:
  244.         type: string
  245.         example: user@gmail.com
  246.       addresses:
  247.         type: "array"
  248.         items:
  249.           $ref: '#/definitions/Address'
  250.   Cart:
  251.     type: object
  252.     required:
  253.      - id
  254.       - status
  255.       - total
  256.     properties:
  257.       id:
  258.         type: string
  259.         example: "42"
  260.       status:
  261.         type: string
  262.         enum: [STILL_SHOPPING, CONVERTING_TO_ORDER, CONVERTED_TO_ORDER, DISCARDED]
  263.         example: STILL_SHOPPING
  264.       created_at:
  265.         type: string
  266.         example: "2017-07-21T17:32:28Z"
  267.       modified_at:
  268.         type: string
  269.         example: "2017-07-21T17:32:28Z"
  270.       comments:
  271.         type: string
  272.         example: "Just a comment"
  273.       total:
  274.         type: string
  275.         example: "32.21"
  276.   CartItem:
  277.     type: object
  278.     required:
  279.      - id
  280.       - cart_id
  281.       - product_id
  282.       - start_date
  283.       - end_date
  284.       - item_type
  285.       - quantity
  286.       - alternate_day
  287.     properties:
  288.       id:
  289.         type: string
  290.         example: "42"
  291.       cart_id:
  292.         type: string
  293.         example: "42"
  294.       product_id:
  295.         type: string
  296.         example: "42"
  297.       start_date:
  298.         type: string
  299.         example: 2022-06-15
  300.       end_date:
  301.         type: string
  302.         example: 2022-06-15
  303.       item_type:
  304.         type: string
  305.         enum: ["subscription", "single_order"]
  306.       quantity:
  307.         type: string
  308.         example: 4
  309.       alternate_day:
  310.         type: boolean
  311.         example: false
  312.       created_at:
  313.         type: string
  314.         example: "2017-07-21T17:32:28Z"
  315.       modified_at:
  316.         type: string
  317.         example: "2017-07-21T17:32:28Z"
  318.   InventoryOverride:
  319.     type: object
  320.     required:
  321.    - product_id
  322.     - date
  323.     - available_quantity
  324.     properties:
  325.       product_id:
  326.         type: string
  327.         example: "42"
  328.       date:
  329.         type: string
  330.         example: 2022-02-14
  331.       available_quantity:
  332.         type: integer
  333.         example: 42
  334.       created_at:
  335.         type: string
  336.         example: "2017-07-21T17:32:28Z"
  337.       modified_at:
  338.         type: string
  339.         example: "2017-07-21T17:32:28Z"
  340.   Subscription:
  341.     type: object
  342.     required:
  343.    - subscription_id
  344.     - user_profile_id
  345.     - product_id
  346.     - start_date
  347.     - end_date
  348.     - alternate_day
  349.     - created_at
  350.     - address_id
  351.     - quantity
  352.     properties:
  353.       subscription_id:
  354.         type: string
  355.       user_profile_id:
  356.         type: string
  357.         example: https://s3.com/link-to-image
  358.       product_id:
  359.         type: string
  360.         example: Milk 1 litre
  361.       start_date:
  362.         type: string
  363.         example: 2022-02-14
  364.       end_date:
  365.         type: string
  366.         example: 2022-02-14
  367.       alternate_day:
  368.         type: boolean
  369.         example: 0
  370.       created_at:
  371.         type: string
  372.         example: 2022-02-14
  373.       address_id:
  374.         type: string
  375.         example: 342A
  376.       quantity:
  377.         type: number
  378.         example: 40
  379.   Product:
  380.     type: object
  381.     required:
  382.    - product_id
  383.     - image_url
  384.     - title
  385.     - short_description
  386.     - description
  387.     - default_capacity
  388.     - discounted_price
  389.     - price
  390.     - subscription_enabled
  391.     - active
  392.     - created_at
  393.     - modified_at
  394.     properties:
  395.       product_id:
  396.         type: string
  397.       image_url:
  398.         type: string
  399.         example: https://s3.com/link-to-image
  400.       title:
  401.         type: string
  402.         example: Milk 1 litre
  403.       short_description:
  404.         type: string
  405.         example: 1 litre glass bottle of milk
  406.       description:
  407.         type: string
  408.         example: xyz abc asdf
  409.       default_capacity:
  410.         type: number
  411.         example: 200
  412.       discounted_price:
  413.         type: number
  414.         example: 40
  415.       price:
  416.         type: number
  417.         example: 50
  418.       subscription_enabled:
  419.         type: boolean
  420.         example: 0
  421.       active:
  422.         type: boolean
  423.         example: 0
  424.       created_at:
  425.         type: string
  426.         example: 2022-02-14
  427.       modified_at:
  428.         type: string
  429.         example: 2022-02-14
  430. host: virtserver.swaggerhub.com
  431. basePath: /tmilq/Milq/1.0.0
  432. schemes:
  433.  - https
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement