import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.productType.list()
.then(({ product_types, count, limit, offset }) => {
console.log(product_types)
}){
"limit": 123,
"offset": 123,
"count": 123,
"product_types": [
{
"id": "<string>",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
],
"estimate_count": 123
}Retrieve a list of product types. The product types can be filtered by fields such as id. The product types can also be sorted or paginated.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.productType.list()
.then(({ product_types, count, limit, offset }) => {
console.log(product_types)
}){
"limit": 123,
"offset": 123,
"count": 123,
"product_types": [
{
"id": "<string>",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"metadata": {}
}
],
"estimate_count": 123
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Search term to filter the product type's searchable properties.
Filter by a product type's ID.
Filter by a type's value.
Filter by the type's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by the type's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by the type's deletion date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Whether to include deleted records in the result.
OK
The paginated list of product types.
The maximum number of items returned.
The number of items skipped before retrieving the returned items.
The total number of items.
The list of product types.
Show child attributes
The type's ID.
The type's value.
The date the type was created.
The date the type was updated.
The date the type was deleted.
The type's metadata, can hold custom key-value pairs.
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.