feat(dashboard,js-sdk,types,admin-shared): Add Product Types domain (#7732)
This commit is contained in:
committed by
GitHub
parent
70a72ce2df
commit
2d8d2c4255
@@ -10,6 +10,7 @@ import { PriceList } from "./price-list"
|
||||
import { Product } from "./product"
|
||||
import { ProductCategory } from "./product-category"
|
||||
import { ProductCollection } from "./product-collection"
|
||||
import { ProductType } from "./product-type"
|
||||
import { Region } from "./region"
|
||||
import { SalesChannel } from "./sales-channel"
|
||||
import { ShippingOption } from "./shipping-option"
|
||||
@@ -26,6 +27,7 @@ export class Admin {
|
||||
public productCategory: ProductCategory
|
||||
public priceList: PriceList
|
||||
public product: Product
|
||||
public productType: ProductType
|
||||
public upload: Upload
|
||||
public region: Region
|
||||
public stockLocation: StockLocation
|
||||
@@ -47,6 +49,7 @@ export class Admin {
|
||||
this.productCategory = new ProductCategory(client)
|
||||
this.priceList = new PriceList(client)
|
||||
this.product = new Product(client)
|
||||
this.productType = new ProductType(client)
|
||||
this.upload = new Upload(client)
|
||||
this.region = new Region(client)
|
||||
this.stockLocation = new StockLocation(client)
|
||||
|
||||
80
packages/core/js-sdk/src/admin/product-type.ts
Normal file
80
packages/core/js-sdk/src/admin/product-type.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class ProductType {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateProductType,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminProductTypeResponse>(
|
||||
`/admin/product-types`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateProductType,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminProductTypeResponse>(
|
||||
`/admin/product-types/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminProductTypeListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminProductTypeListResponse>(
|
||||
`/admin/product-types`,
|
||||
{
|
||||
headers,
|
||||
query: query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
id: string,
|
||||
query?: HttpTypes.AdminProductTypeParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return this.client.fetch<HttpTypes.AdminProductTypeResponse>(
|
||||
`/admin/product-types/${id}`,
|
||||
{
|
||||
query,
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return this.client.fetch<HttpTypes.AdminProductTypeDeleteResponse>(
|
||||
`/admin/product-types/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export class Product {
|
||||
)
|
||||
}
|
||||
async list(
|
||||
queryParams?: HttpTypes.AdminProductParams,
|
||||
queryParams?: HttpTypes.AdminProductListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminProductListResponse>(
|
||||
|
||||
Reference in New Issue
Block a user