openapi: 3.0.0
info:
  title: SkiNet
  version: 1.0.0
servers:
  - url: https://localhost:5001
  - url: http://{{url}}
tags:
  - name: Section 2 - API Basics
  - name: Section 3 - Architecture
  - name: Section 4 - Genrics
  - name: Section 5 - Error Handling
  - name: Section 6 - Paging, Sorting and Filtering
  - name: Section 13 - Basket
  - name: Section 15 - Identity
  - name: Section 16 - Validation
  - name: Section 18 - Ordering
  - name: Section 21 - Payments
paths:
  /weatherforecast:
    get:
      tags:
        - Section 2 - API Basics
      summary: Get Weather Forecast
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/products:
    get:
      tags:
        - Section 6 - Paging, Sorting and Filtering
      summary: Check Cors is enabled
      parameters:
        - name: Origin
          in: header
          schema:
            type: string
          example: https://localhost:4200
        - name: typeId
          in: query
          schema:
            type: integer
          example: '3'
        - name: brandId
          in: query
          schema:
            type: integer
          example: '2'
        - name: sort
          in: query
          schema:
            type: string
          example: priceDesc
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/products/2:
    get:
      tags:
        - Section 4 - Genrics
      summary: Get Product
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/products/brands:
    get:
      tags:
        - Section 4 - Genrics
      summary: Get Product Types
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/products/types:
    get:
      tags:
        - Section 3 - Architecture
      summary: Get Product Types
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/buggy/notfound:
    get:
      tags:
        - Section 5 - Error Handling
      summary: Get Not Found Product
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/buggy/servererror:
    get:
      tags:
        - Section 5 - Error Handling
      summary: Get Null Ref Error
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/buggy/badrequest:
    get:
      tags:
        - Section 5 - Error Handling
      summary: Get 400 Error
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/buggy/badrequest/five:
    get:
      tags:
        - Section 5 - Error Handling
      summary: Get 400 Validation error
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/endpointthatdoesnotexist:
    get:
      tags:
        - Section 5 - Error Handling
      summary: Get Not Found Endpoint
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/basket:
    get:
      tags:
        - Section 13 - Basket
      summary: Get Basket
      parameters:
        - name: id
          in: query
          schema:
            type: string
          example: basket1
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
        - Section 21 - Payments
      summary: Update Basket with client secret as bob
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                id: order1
                items:
                  - id: 4
                    productName: .NET Black & White Mug
                    price: 8.5
                    quantity: 3
                    pictureUrl: https://localhost:5001/images/products/2.png
                    brand: .NET
                    type: USB Memory Stick
                deliveryMethodId: null
                clientSecret: pi_1G58xoBMsPE8xicUEzksgfsT
                paymentIntentId: pi_1G58xoBMsPE8xicUEzksgfsT
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
        - Section 13 - Basket
      summary: Delete Basket
      parameters:
        - name: id
          in: query
          schema:
            type: string
          example: b2
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/account/login:
    post:
      tags:
        - Section 15 - Identity
      summary: Login as Tom and save token to env
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: tom@test.com
                password: Pa$$w0rd
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/account/register:
    post:
      tags:
        - Section 16 - Validation
      summary: Register as Luke with bad email address
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                displayName: ''
                email: notanemail
                password: Pa$$w0rd
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/buggy/testauth:
    get:
      tags:
        - Section 15 - Identity
      summary: Get Secret from buggy With Auth
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/account:
    get:
      tags:
        - Section 15 - Identity
      summary: Get Current User (bob)
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/account/emailExists:
    get:
      tags:
        - Section 15 - Identity
      summary: Check if email exists
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
        - name: email
          in: query
          schema:
            type: string
          example: bob@test.com
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/account/address:
    get:
      tags:
        - Section 15 - Identity
      summary: Get User Address (bob)
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    put:
      tags:
        - Section 15 - Identity
      summary: Add User Address (tom)
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                firstName: Tom
                lastName: Smith
                street: 100 Park Lane
                city: London
                state: London
                zipCode: SW1 1B
                country: UK
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{tom_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
        - Section 16 - Validation
      summary: Update User Address (tom) - Empty Address
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                firstName: Tom
                lastName: Smith
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{tom_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/orders:
    post:
      tags:
        - Section 18 - Ordering
      summary: Checkout as bob order1
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                basketId: basket1
                deliveryMethodId: 1
                shipToAddress:
                  firstName: Bob
                  lastName: Bobbity
                  street: 10 The Street
                  city: New York
                  state: NY
                  country: USA
                  zipcode: '90250'
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    get:
      tags:
        - Section 18 - Ordering
      summary: Get Orders For User (bob)
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/orders/1:
    get:
      tags:
        - Section 18 - Ordering
      summary: Get Order For User (bob)
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/orders/deliveryMethods:
    get:
      tags:
        - Section 18 - Ordering
      summary: Get DeliveryMethods
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /api/payments/basket1:
    post:
      tags:
        - Section 21 - Payments
      summary: Update payment intent as bob
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example: {}
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Bearer {{bob_token}}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
