openapi: 3.0.0
info:
  title: Digital Products
  version: 1.0.0
servers:
  - url: http://{{backend_url}}
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
tags:
  - name: Admin
  - name: Admin > Auth
  - name: Admin > Digital Products
  - name: Store
  - name: Store > Auth
paths:
  /auth/user/emailpass:
    post:
      tags:
        - Admin > Auth
      summary: Login
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: admin@medusajs.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /admin/digital-products:
    get:
      tags:
        - Admin > Digital Products
      summary: List Digital Products
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
        - Admin > Digital Products
      summary: Create Digital Product
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                name: Harry Potter
                medias:
                  - type: preview
                    file_id: preview.jpg
                    mime_type: image/jpeg
                  - type: main
                    file_id: main.jpg
                    mime_type: image/jpeg
                product:
                  title: Book
                  options:
                    - title: Default
                      values:
                        - default
                  variants:
                    - title: Book
                      prices:
                        - currency_code: eur
                          amount: 10
                      options:
                        Default: default
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /admin/digital-products/upload/main:
    post:
      tags:
        - Admin > Digital Products
      summary: Upload File
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: string
                  format: binary
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /auth/customer/emailpass:
    post:
      tags:
        - Store > Auth
      summary: Get JWT / Login
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: customer@gmail.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/customers:
    post:
      tags:
        - Store > Auth
      summary: Register Customer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: customer@gmail.com
                first_name: Customer
                last_name: Example
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/customers/me/digital-products:
    get:
      tags:
        - Store
      summary: Get Purchased Digital Products
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/customers/me/digital-products/01J357GHDAM1KAQVTBGP14V8V3/download:
    post:
      tags:
        - Store
      summary: Download Product
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/digital-products/01J35H1NBB23H5QK1XAHBFKF3V/preview:
    get:
      tags:
        - Store
      summary: Get Digital Product Preview
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
