Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 21.01 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3.   version: "0.0.1"
  4.   title: Happy clean Server
  5. # during dev, should point to your local machine
  6. host: localhost:10010
  7. # basePath prefixes all resource paths
  8. basePath: /_aVlM10DR
  9. #
  10. schemes:
  11.  # tip: remove http to make production-grade
  12.   - http
  13.   - https
  14. # format of bodies a client can send (Content-Type)
  15. consumes:
  16.  - application/json
  17.   - text/html
  18.   - text/plain; charset=UTF-8
  19. # format of the responses to the client (Accepts)
  20. produces:
  21.  - application/json
  22.   - text/plain; charset=UTF-8
  23.   - text/html
  24.  
  25. securityDefinitions:
  26.   ApiKeyAuth:
  27.     type: apiKey
  28.     in: header
  29.     name: X-API-Key
  30.  
  31.   OAuth2:
  32.     type: oauth2
  33.     flow: accessCode
  34.     authorizationUrl: https://localhost/oauth/authorize
  35.     tokenUrl: https://localhost/oauth/token
  36.  
  37.     scopes:
  38.       read: Grants read access
  39.       write: Grants write access
  40.       admin: Grants read and write access to administrative information
  41.  
  42. paths:
  43.   /m/user:
  44.    # our controller name
  45.     x-swagger-router-controller: user
  46.     get:
  47.       tags:
  48.      - "User"
  49.       summary: "Get a user list"
  50.       security:
  51.         - OAuth2: [read]
  52.       operationId: getAllUsers
  53.       # define the type of response for Success "200" and Error
  54.       responses:
  55.         "200":
  56.           description: Success
  57.           schema:
  58.             $ref: "#/definitions/GetusersListResponse"
  59.         default:
  60.           description: Error
  61.           schema:
  62.             $ref: "#/definitions/ErrorResponse"
  63.     post:
  64.       tags:
  65.        - "User"
  66.       summary: "Create a new user"
  67.       security:
  68.         - OAuth2: [read, write]
  69.       operationId: saveUser
  70.       # user info to be stored
  71.       parameters:
  72.         - name: body
  73.           description: User information
  74.           in: body
  75.           required: true
  76.           schema:
  77.             $ref: "#/definitions/user"
  78.  
  79.         - name: password
  80.           in: header
  81.           type: string
  82.           format: password
  83.           required: true
  84.  
  85.       responses:
  86.         201:
  87.           description: Created confirmation.
  88.           schema:
  89.             $ref: "#/definitions/GeneralResponse"
  90.         409:
  91.           description: Must be sended when user_email already exist
  92.         default:
  93.           description: Unexpected Error
  94.           schema:
  95.             $ref: "#/definitions/ErrorResponse"
  96.   #/m/user/{id}/{email}:
  97.   /m/user/{userId}:
  98.    # our controller name
  99.     x-swagger-router-controller: user
  100.     get:
  101.       tags:
  102.      - "User"
  103.       summary: "Get a existing user"
  104.       security:
  105.         - OAuth2: [read]
  106.       operationId: getUserById
  107.       # define the type of response for Success "200" and Error
  108.       parameters:
  109.         - name: userId
  110.           type: string
  111.           in: path
  112.           required: true
  113.       responses:
  114.         "200":
  115.           description: Success
  116.           schema:
  117.             $ref: "#/definitions/GetuserResponse"
  118.         default:
  119.           description: Error
  120.           schema:
  121.             $ref: "#/definitions/ErrorResponse"
  122.     put:
  123.       tags:
  124.      - "User"
  125.       summary: "Update a existing user"
  126.       security:
  127.         - OAuth2: [read, write]
  128.       operationId: updateUser
  129.       # define the type of response for Success "200" and Error
  130.       parameters:
  131.         - name: userId
  132.           type: string
  133.           in: path
  134.           required: true
  135.  
  136.         - name: body
  137.           description: User information that needs to be updated
  138.           in: body
  139.           required: true
  140.           schema:
  141.             $ref: "#/definitions/user"
  142.       responses:
  143.         400:
  144.           description: "Invalid ID supplied"
  145.         404:
  146.           description: "User not found"
  147.         405:
  148.           description: "Validation exception"
  149.  
  150.  
  151.   /m/user/{userId}/order:
  152.    # our controller name
  153.     x-swagger-router-controller: user
  154.     get:
  155.       tags:
  156.      - "User"
  157.       summary: "Get order list"
  158.       security:
  159.         - OAuth2: [read]
  160.       operationId: getUserOrders
  161.       parameters:
  162.         - name: userId
  163.           type: string
  164.           in: path
  165.           required: true
  166.  
  167.       responses:
  168.         "200":
  169.           description: Success
  170.           schema:
  171.             $ref: "#/definitions/GetorderListResponse"
  172.         default:
  173.           description: Error
  174.           schema:
  175.             $ref: "#/definitions/ErrorResponse"
  176.     post:
  177.       tags:
  178.      - "User"
  179.       summary: "Create a new order"
  180.       security:
  181.         - OAuth2: [read, write]
  182.       operationId: createUserOrder
  183.       # define the type of response for Success "200" and Error
  184.       parameters:
  185.         - name: body
  186.           description: Necessary information to create a new order
  187.           in: body
  188.           required: true
  189.           schema:
  190.             $ref: "#/definitions/orders"
  191.       responses:
  192.         201:
  193.           description: Order created with success.
  194.           schema:
  195.             $ref: "#/definitions/GeneralResponse"
  196.         default:
  197.           description: Unexpected Error
  198.           schema:
  199.             $ref: "#/definitions/ErrorResponse"
  200.  
  201.  
  202.   /m/user/{userId}/order/{orderId}:
  203.    # our controller name
  204.     x-swagger-router-controller: user
  205.     get:
  206.       tags:
  207.      - "User"
  208.       summary: "Get a existing order"
  209.       security:
  210.         - OAuth2: [read]
  211.       operationId: getUserOrder
  212.       parameters:
  213.         - name: userId
  214.           type: string
  215.           in: path
  216.           required: true
  217.  
  218.         - name: orderId
  219.           type: string
  220.           in: path
  221.           required: true
  222.  
  223.       responses:
  224.         "200":
  225.           description: Success
  226.           schema:
  227.             $ref: "#/definitions/GetorderResponse"
  228.         default:
  229.           description: Error
  230.           schema:
  231.             $ref: "#/definitions/ErrorResponse"
  232.  
  233.   /user/{userId}/order/{range}:
  234.    # our controller name
  235.     x-swagger-router-controller: user
  236.     get:
  237.       tags:
  238.      - "User"
  239.       summary: "Get order list between date range"
  240.       security:
  241.         - OAuth2: [read]
  242.       operationId: getUserOrderRange
  243.       parameters:
  244.         - name: userId
  245.           type: string
  246.           in: path
  247.           required: true
  248.  
  249.         - name: range
  250.           type: array
  251.           items:
  252.             type: string
  253.             format: dateTime
  254.           in: path
  255.           required: true
  256.  
  257.       responses:
  258.         "200":
  259.           description: Success
  260.           schema:
  261.             $ref: "#/definitions/GetorderListResponse"
  262.         default:
  263.           description: Error
  264.           schema:
  265.             $ref: "#/definitions/ErrorResponse"
  266.  
  267.   /user/{userId}/closet:
  268.    # our controller name
  269.     x-swagger-router-controller: user
  270.     get:
  271.       tags:
  272.      - "User"
  273.       summary: "Get all clothes from the user"
  274.       security:
  275.         - OAuth2: [read]
  276.       operationId: getUserCloset
  277.       parameters:
  278.         - name: userId
  279.           type: string
  280.           in: path
  281.           required: true
  282.  
  283.       responses:
  284.         "200":
  285.           description: Success
  286.           schema:
  287.             $ref: "#/definitions/GetclothesListResponse"
  288.         default:
  289.           description: Error
  290.           schema:
  291.             $ref: "#/definitions/ErrorResponse"
  292.  
  293.     post:
  294.       tags:
  295.      - "User"
  296.       summary: "Creat a new clothes"
  297.       security:
  298.         - OAuth2: [read, write]
  299.       operationId: saveUserClothes
  300.       parameters:
  301.         - name: userId
  302.           type: string
  303.           in: path
  304.           required: true
  305.  
  306.         - name: body
  307.           description: Data to add a new clothes
  308.           in: body
  309.           required: true
  310.           schema:
  311.             $ref: "#/definitions/clothes"
  312.       responses:
  313.         201:
  314.           description: Clothes created with success.
  315.           schema:
  316.             $ref: "#/definitions/GeneralResponse"
  317.         default:
  318.           description: Unexpected Error
  319.           schema:
  320.             $ref: "#/definitions/ErrorResponse"
  321.  
  322.   /m/user/{userId}/closet/{clothingId}:
  323.     put:
  324.       tags:
  325.      - "User"
  326.       summary: "Update a  clothing"
  327.       security:
  328.         - OAuth2: [read, write]
  329.       operationId: updateUserClothing
  330.       parameters:
  331.         - name: userId
  332.           type: string
  333.           in: path
  334.           required: true
  335.  
  336.         - name: clothingId
  337.           type: string
  338.           in: path
  339.           required: true
  340.  
  341.         - name: body
  342.           description: Data to update a clothing
  343.           in: body
  344.           required: true
  345.           schema:
  346.             $ref: "#/definitions/clothes"
  347.       responses:
  348.         400:
  349.           description: "Invalid ID supplied"
  350.         404:
  351.           description: "Clothing not found"
  352.         405:
  353.           description: "Validation exception"
  354.  
  355.  
  356.  
  357.   #/m/user/closet:
  358.  
  359.   #/m/user/orders:
  360.  
  361.   #/m/user/address:
  362.  
  363.   #/m/store:
  364.  
  365.   #/m/store/calc:
  366.  
  367.   #/m/orders:
  368.  
  369.  
  370.  
  371.   /swagger:
  372.     x-swagger-pipe: swagger_raw
  373. # complex objects have schema definitions
  374. definitions:
  375.   ErrorResponse:
  376.     type: object
  377.     required:
  378.      - code
  379.       - message
  380.       - fields
  381.     properties:
  382.       code:
  383.         type: integer
  384.         format: int32
  385.       message:
  386.         type: string
  387.       fields:
  388.         type: string
  389.   GetusersListResponse:
  390.     required:
  391.      - users
  392.     properties:
  393.      # The array of users
  394.       users:
  395.         type: array
  396.         items:
  397.           type: object
  398.           properties:
  399.             id:
  400.               type: string
  401.             email:
  402.               type: string
  403.             password:
  404.               type: string
  405.  
  406.   GetorderListResponse:
  407.     required:
  408.      - orders
  409.     properties:
  410.      # The array of orders
  411.       orders:
  412.         type: array
  413.         items:
  414.           type: object
  415.           properties:
  416.             schema:
  417.               $ref: "#/definitions/orders"
  418.  
  419.   GetorderResponse:
  420.     required:
  421.      - order
  422.     properties:
  423.      # The  order
  424.       order:
  425.         properties:
  426.           schema:
  427.             $ref: "#/definitions/orders"
  428.  
  429.   GetclothesListResponse:
  430.     required:
  431.      - clothes
  432.     properties:
  433.      # The array of clothes
  434.       clothes:
  435.         type: array
  436.         items:
  437.           type: object
  438.           properties:
  439.             schema:
  440.               $ref: "#/definitions/clothes"
  441.  
  442.   user:
  443.     type: object
  444.     properties:
  445.       username:
  446.         type: string
  447.         description: Name of new user
  448.       email:
  449.         type: string
  450.         description: email from the user
  451.         pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]{2,64}$'
  452.     required:
  453.      - username
  454.       - email
  455.   GeneralResponse:
  456.     type: object
  457.     properties:
  458.       success:
  459.         type: number
  460.         description: returns 1 if successful
  461.       description:
  462.         type: string
  463.         description: a short comment
  464.     required:
  465.      - success
  466.       - description
  467.   GetuserResponse:
  468.     required:
  469.      - id
  470.       - email
  471.       - password
  472.     properties:
  473.       id:
  474.         type: string
  475.       email:
  476.         type: string
  477.       password:
  478.         type: string
  479.   status_pedido:
  480.     type: object
  481.     title: 'Estado do pedido'
  482.     description: 'Relação de estados assumíveis para um pedido'
  483.     enum: &STATUS
  484.       - 'Entregue'
  485.       - 'Finalizado'
  486.       - 'Solicitado'
  487.       - 'Em andamento'
  488.   basic_services:
  489.     type: object
  490.     title: 'Serviços básicos'
  491.     description: 'Relação de serviços básicos'
  492.     enum: &BASIC_SERVICES
  493.       - 'Completo'
  494.       - 'Passadoria'
  495.       - 'Recuperação'
  496.   especial_service:
  497.     type: object
  498.     title: 'Serviço especial'
  499.     description: 'Serviço especial oferecido pela lavanderia'
  500.     properties:
  501.       name:
  502.         type: string
  503.         description: 'Nome do serviço especial'
  504.       price:
  505.         type: number
  506.         format: float
  507.         description: 'Custo do serviço especial'
  508.       description:
  509.         type: string
  510.         description: 'Descrição do serviço especial'
  511.       icon:
  512.         type: string
  513.         format: byte
  514.         description: 'Icone representativo do serviço especial'
  515.   clothes:
  516.     type: object
  517.     title: 'Clothes'
  518.     description: 'Peça de roupa'
  519.     uniqueItems: true
  520.     properties:
  521.       enabled:
  522.         type: boolean
  523.         description: 'Status da peça (false, caso desabilitado/excluida)'
  524.       version:
  525.         type: number
  526.         title: 'Versão do documento'
  527.         description: 'Contador que deve ser incrementado sempre que uma alteração no documento for realizada. Um "cópia" do documento antigo deve ser gerado'
  528.       pictures:
  529.         type: array
  530.         description: 'Fotos das peças de roupas. Deve ser limitada a trÊs fotos por peça'
  531.         items:
  532.           type: string
  533.           format: byte
  534.           description: 'Foto da peça'
  535.       type:
  536.         type: string
  537.         description: 'Tipo da peça de roupa EX: Camisa, Calça, Meia'
  538.       brand:
  539.         type: string
  540.         description: 'Marca da roupa'
  541.       color:
  542.         type: string
  543.         description: 'Cor predominante da roupa'
  544.       print:
  545.         type: string
  546.         description: 'Estampa da roupa'
  547.       station:
  548.         type: string
  549.         description: 'Estação para uso da roupa'
  550.       observations:
  551.         type: array
  552.         description: 'Observações individuais da peça de roupa'
  553.         items:
  554.           type: string
  555.       whashes:
  556.         type: integer
  557.         description: 'Número de lavagens sofridas pela peça'
  558.       register_date:
  559.         type: string
  560.         format: date
  561.         description: 'Data de cadastro da peça'
  562.   orders:
  563.     type: object
  564.     title: 'Order'
  565.     description: 'Pedido realizado pelo usuário'
  566.     properties:
  567.       solicitation_time:
  568.         type: string
  569.         format: date-time
  570.         description: 'Data de realização do pedido'
  571.       finish_time:
  572.         type: string
  573.         format: date-time
  574.         description: 'Data de finalização do pedido'
  575.       removal_time:
  576.         type: string
  577.         format: date-time
  578.         description: 'Data de retirada/entrega do pedido'
  579.       status:
  580.         $ref: '#definitions/status_pedido'
  581.       cart_itens:
  582.         type: object
  583.         properties:
  584.           clothes:
  585.             type: array
  586.             description: 'Itens do pedido'
  587.             items:
  588.               type: object
  589.               properties:
  590.                 clothes:
  591.                   $ref: '#/definitions/clothes'
  592.                 whase_type:
  593.                   $ref: '#/definitions/basic_services'
  594.                 price:
  595.                   type: number
  596.                   title: 'Price'
  597.                   format: float
  598.           services:
  599.             type: array
  600.             items:
  601.               type: object
  602.               properties:
  603.                 price:
  604.                   type: number
  605.                   title: 'Price'
  606.                   format: float
  607.                 service:
  608.                   $ref: '#/definitions/especial_service'
  609.   agent:
  610.     type: object
  611.     title: 'Agent'
  612.     description: 'Dados do representante da loja'
  613.     properties:
  614.       name:
  615.         type: string
  616.         description: 'Nome do representante da loja'
  617.       email:
  618.         type: string
  619.         description: 'Email do representante da loja'
  620.         pattern: '[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}'
  621.       cpf:
  622.         type: string
  623.         description: 'CPF do representante da loja'
  624.       password:
  625.         type: string
  626.         format: password
  627.         description: 'Chave de acesso do usuário ao sistema'
  628.   administrator:
  629.     type: object
  630.     title: 'Administrator'
  631.     description: 'Usário administrador do sistema'
  632.     properties:
  633.       email:
  634.         type: string
  635.         description: 'Email de contato do administrator do sistema'
  636.       password:
  637.         type: string
  638.         format: password
  639.   store:
  640.     type: object
  641.     title: 'Store'
  642.     description: 'Entidade que ofereçe os serviços e é selecionavel pelo usuário'
  643.     properties:
  644.       tipo:
  645.         type: object
  646.         description: 'Tipo de loja EX:. Franqueado, Autonoma'
  647.         enum: &laundery_type
  648.           - 'Franqueado'
  649.           - 'Autonoma'
  650.       name:
  651.         type: string
  652.         description: 'Nome fantasia da loja'
  653.       social_reason:
  654.         type: string
  655.         description: 'Razão social da loja'
  656.       cnpj:
  657.         type: string
  658.         description: 'CNPJ da loja'
  659.       ie:
  660.         type: 'string'
  661.         description: 'Inscrição estadual'
  662.       adrress:
  663.         type: string
  664.         description: 'Endereço da loja'
  665.       agent:
  666.         $ref: '#/definitions/agent'
  667.       especial_services:
  668.         type: array
  669.         description: 'Relação de servicos especiais oferecidos'
  670.         items:
  671.           $ref: '#/definitions/especial_service'
  672.       delivery_services:
  673.         type: object
  674.         properties:
  675.           delivery:
  676.             type: boolean
  677.             description: 'Disponibilidade do serviço de delivery'
  678.           checkin:
  679.             type: boolean
  680.             description: 'Disponibilidade do serviço de entrega e retirada na loja'
  681.       washebles:
  682.         type: array
  683.         description: 'Lista de tipos aceitos pela loja'
  684.         items:
  685.             type: object
  686.             properties:
  687.               name:
  688.                 type: string
  689.                 description: 'Tipo de peça pré-autorizado pela loja'
  690.               enabled:
  691.                 type: boolean
  692.                 description: 'Status de disponibilidade da peça'
  693.               icon:
  694.                 type: string
  695.                 description: 'Icone default'
  696.               services:
  697.                 type: object
  698.                 description: 'Serviço básicos oferecidos pela loja. Limitados a três'
  699.                 properties:
  700.                   complete:
  701.                     type: object
  702.                     description: 'Serviço básico 1'
  703.                     properties:
  704.                       price:
  705.                         type: number
  706.                         format: float
  707.                       enabled:
  708.                         type: boolean
  709.                         description: 'Disponibilidade do serviço básico'
  710.                   recovery:
  711.                     type: object
  712.                     description: 'Serviço básico 2'
  713.                     properties:
  714.                       price:
  715.                         type: number
  716.                         format: float
  717.                       enabled:
  718.                         type: boolean
  719.                         description: 'Disponibilidade do serviço básico'
  720.                   ironing:
  721.                     type: object
  722.                     description: 'Serviço básico 3'
  723.                     properties:
  724.                       price:
  725.                         type: number
  726.                         format: float
  727.                       enabled:
  728.                         type: boolean
  729.                         description: 'Disponibilidade do serviço básico'
  730.  
  731.   franchise:
  732.     type: object
  733.     title: 'Franchise'
  734.     properties:
  735.       name:
  736.         type: string
  737.         description: 'Nome fantasia da loja'
  738.       social_reason:
  739.         type: string
  740.         description: 'Razão social da loja'
  741.       cnpj:
  742.         type: string
  743.         description: 'CNPJ da loja'
  744.       ie:
  745.         type: 'string'
  746.         description: 'Inscrição estadual'
  747.       adrress:
  748.         type: string
  749.         description: 'Endereço da loja'
  750.       agent:
  751.         $ref: '#/definitions/agent'
  752.       stores:
  753.         type: array
  754.         items:
  755.           $ref: '#/definitions/store'
  756.   client:
  757.     type: object
  758.     title: 'Client'
  759.     properties:
  760.       name:
  761.         type: string
  762.         description: 'Nome completo do usuário do sitema'
  763.       email:
  764.         type: string
  765.         description: 'Email ativo do usuário'
  766.       password:
  767.         type: string
  768.         format: password
  769.         description: 'Chave de acesso do usuário ao sistema'
  770.       contact:
  771.         type: string
  772.         description: 'Telefone do usuário'
  773.       addresses:
  774.         type: array
  775.         description: 'Lista de endereços ativos do usuário'
  776.         items:
  777.           type: object
  778.           properties:
  779.             postal_code:
  780.               type: string
  781.               description: 'Código postal (CEP) do endereço'
  782.             city:
  783.               type: string
  784.               description: 'Nome da Cidade'
  785.             neighborhood:
  786.               type: string
  787.               description: 'Nome do bairro'
  788.             place:
  789.               type: string
  790.               description: 'Logradouro do endereço'
  791.       status:
  792.         type: boolean
  793.         description: 'Status do usuário'
  794.       register_date:
  795.         type: string
  796.         format: date
  797.         description: 'Data de registro do usuário'
  798.       closet:
  799.         type: array
  800.         description: 'Conjunto de peças de roupas do usuário'
  801.         items:
  802.           $ref: '#/definitions/clothes'
  803.       orders:
  804.         type: array
  805.         items:
  806.           $ref: '#/definitions/orders'
  807.   Error:
  808.     type: object
  809.     properties:
  810.       code:
  811.         type: integer
  812.         format: int32
  813.       message:
  814.         type: string
  815.       fields:
  816.         type: string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement