feat(dashboard,types,js-sdk): Cleanup collection domain (#7502)
**What** - Adds missing collection HttpTypes - Adds missing sdk functions - Adds usage of sdk to collection domain.
This commit is contained in:
@@ -203,7 +203,10 @@ export class Admin {
|
||||
}
|
||||
)
|
||||
},
|
||||
list: async (queryParams?: FindParams, headers?: ClientHeaders) => {
|
||||
list: async (
|
||||
queryParams?: FindParams & HttpTypes.AdminCollectionFilters,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<
|
||||
PaginatedResponse<{ customers: HttpTypes.AdminCustomer[] }>
|
||||
>(`/admin/customers`, {
|
||||
@@ -234,4 +237,82 @@ export class Admin {
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
public collection = {
|
||||
create: async (
|
||||
body: HttpTypes.AdminCreateCollection,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
|
||||
`/admin/collections`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
},
|
||||
update: async (
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateCollection,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
|
||||
`/admin/collections/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
},
|
||||
list: async (queryParams?: FindParams, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<
|
||||
PaginatedResponse<{ collections: HttpTypes.AdminCollection[] }>
|
||||
>(`/admin/collections`, {
|
||||
headers,
|
||||
query: queryParams,
|
||||
})
|
||||
},
|
||||
retrieve: async (
|
||||
id: string,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
|
||||
`/admin/collections/${id}`,
|
||||
{
|
||||
query,
|
||||
headers,
|
||||
}
|
||||
)
|
||||
},
|
||||
delete: async (id: string, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<DeleteResponse<"collection">>(
|
||||
`/admin/collections/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
},
|
||||
updateProducts: async (
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateCollectionProducts,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
|
||||
`/admin/collections/${id}/products`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
}
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user