DwightAI / swagger.yaml
sujoydev99's picture
...
146b1cb
openapi: 3.0.0
info:
title: Express API Documentation
version: 1.0.0
description: This is the API documentation for my Express application.
servers:
- url: https://934a-45-119-30-178.ngrok-free.app
paths:
/_healthz:
get:
operationId: getHealthZ
description: Check server health
responses:
'200':
description: Server is healthy
content:
text/plain:
schema:
type: string
example: Hello World!
/company/{companyId}:
get:
operationId: getOrVerifyCompanyCredentials
description: Retrieve company credentials
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The company ID
responses:
'200':
description: Company credentials retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyCreds'
'404':
description: Company credentials not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
put:
operationId: updateCompanyCredentials
description: Update company credentials
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The company ID
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyCreds'
responses:
'200':
description: Company credentials updated successfully
content:
application/json:
schema:
type: object
properties:
message:
type: string
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/company/{companyId}/applications:
get:
operationId: getSalesChannelByCompany
description: Retrieve applications for a specific company
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The ID of the company to retrieve applications for
responses:
'200':
description: List of applications for the specified company
content:
application/json:
schema:
type: array
items:
type: object
properties:
name:
type: string
description: Name of the application
id:
type: string
description: ID of the application
token:
type: string
description: Token associated with the application
domain:
type: string
description: Primary domain of the application
logo:
type: string
description: Logo URL of the application
'500':
description: Server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/company/{companyId}/brands:
get:
summary: Retrieves a list of brands for a specific company
tags:
- Brands
operationId: getCompanyBrands
description: Fetches a list of brands associated with the given company ID.
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The unique identifier of the company
responses:
'200':
description: A list of brands
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Brand'
post:
summary: Creates a new brand for a specific company
tags:
- Brands
operationId: createCompanyBrand
description: Adds a new brand to the company profile.
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The unique identifier of the company
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BrandCreation'
responses:
'200':
description: Brand created successfully
content:
application/json:
schema:
type: object
properties:
message:
type: string
id:
type: string
/company/{companyId}/brands/{brandId}:
put:
summary: Creates a new brand for a specific company
tags:
- Brands
operationId: updateCompanyBrand
description: updated an existing brand.
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The unique identifier of the company
- in: path
name: brandId
required: true
schema:
type: number
description: The unique identifier of the brand
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BrandCreation'
responses:
'200':
description: Brand updated successfully
content:
application/json:
schema:
type: object
properties:
message:
type: string
id:
type: string
/company/{companyId}/locations:
get:
operationId: getLocationsByCompany
description: get all company locations
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The ID of the company to add a location for
responses:
'200':
description: location list
content:
application/json:
schema:
type: array
items:
properties:
id:
type: number
description: Location id
code:
type: string
description: Location code
name:
type: string
description: Location code
documents:
type: array
description: Location gst documents
items:
type: object
properties:
type:
type: string
description: document type
value:
type: string
description: document number
verified:
type: boolean
description: document number verification status
legal_name:
type: boolean
description: document owner
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: createLocationsForCompany
description: Add a new location for a specific company
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The ID of the company to add a location for
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUpdateLocation'
responses:
'200':
description: Location created successfully
content:
application/json:
schema:
type: object
properties:
message:
type: string
id:
type: string
description: Location id
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/company/{companyId}/locations/{locationId}:
put:
operationId: updateLocationByCompany
description: update a location for a specific company
tags:
- Company
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The ID of the company to add a location for
- in: path
name: locationId
required: true
schema:
type: string
description: The ID of the location to be updated
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUpdateLocation'
responses:
'200':
description: Location updated successfully
content:
application/json:
schema:
type: object
properties:
message:
type: string
id:
type: string
description: Location id
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/company/{companyId}/products:
post:
summary: Creates a new product for a given company.
description: >-
This endpoint creates a new product with various attributes including
name, slug, pricing, and more.
operationId: createProduct
tags:
- Products
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: Unique identifier of the company.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- slug
- seller_identifier
- brand_id
properties:
name:
type: string
description: Name of the product.
slug:
type: string
description: URL-friendly identifier for the product.
seller_identifier:
type: string
description: Unique identifier for the seller.
brand_id:
type: string
description: Unique identifier for the brand.
location_id:
type: string
description: Location identifier for the product.
mrp:
type: number
default: 999
description: Maximum retail price of the product.
selling_price:
type: number
default: 499
description: Selling price of the product.
responses:
'200':
description: Successful creation of the product.
content:
application/json:
schema:
type: object
properties:
message:
type: string
id:
type: string
seller_identifier:
type: string
/company/{companyId}/products/{productId}/inventory:
post:
summary: Updates inventory for a specific product.
description: >-
This endpoint updates the inventory details for a given product,
including location, pricing, and quantity.
operationId: updateInventory
tags:
- Inventory
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: Unique identifier of the company.
- in: path
name: productId
required: true
schema:
type: string
description: Unique identifier of the product.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- location_id
- seller_identifier
properties:
location_id:
type: string
description: Location identifier where the inventory is stored.
mrp:
type: number
default: 999
description: Maximum retail price of the product.
selling_price:
type: number
default: 499
description: Selling price of the product.
seller_identifier:
type: string
description: Unique identifier for the seller.
responses:
'200':
description: Successful update of inventory.
content:
application/json:
schema:
type: object
properties:
message:
type: string
/company/{companyId}/sales_channel:
post:
operationId: addSalesChannel
summary: Create a sales channel for a given company
description: This endpoint creates a new sales channel for the specified company.
tags:
- Sales Channel
parameters:
- in: path
name: companyId
required: true
schema:
type: string
description: The ID of the company
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
brand_ids:
type: array
items:
type: integer
description: Array of brand IDs to be associated with the sales channel
name:
type: string
description: Name of the sales channel
subdomain:
type: string
description: subdomain associated with the sales channel
responses:
'200':
description: Sales channel successfully created
content:
application/json:
schema:
type: object
properties:
message:
type: string
app:
type: object
description: Details of the created sales channel
'400':
description: Bad request
'500':
description: Internal server error
components:
schemas:
CompanyCreds:
type: object
properties:
clientId:
type: string
description: Client ID for the company
clientSecret:
type: string
description: Client secret for the company
required:
- clientId
- clientSecret
CreateUpdateLocation:
type: object
required:
- code
- name
- gst
- manager
- address
properties:
code:
type: string
description: Unique code for the location
name:
type: string
description: Name of the location
gst:
type: object
required:
- legal_name
- value
properties:
legal_name:
type: string
description: Legal name for GST purposes
value:
type: string
description: GST value
manager:
type: object
required:
- manager_name
- email
- number
- country_code
properties:
manager_name:
type: string
description: Name of the manager
email:
type: string
description: Email of the manager
number:
type: string
description: Contact number of the manager
country_code:
type: string
description: Country code for the manager's contact number
address:
type: object
required:
- address1
- country
- pincode
- city
- state
properties:
address1:
type: string
description: Primary address line
address2:
type: string
description: Secondary address line
country:
type: string
description: Country of the location
pincode:
type: string
description: Postal code of the location
city:
type: string
description: City of the location
state:
type: string
description: State of the location
latitude:
type: number
description: Latitude for the location
longitude:
type: number
description: Longitude for the location
landmark:
type: string
description: Landmark near the location
Brand:
type: object
properties:
name:
type: string
logo:
type: string
id:
type: string
BrandCreation:
type: object
required:
- name
- logo
- description
properties:
name:
type: string
logo:
type: string
description:
type: string
ErrorResponse:
type: object
properties:
message:
type: string
description: Error message
tags: []