feat(): Translation settings + user configuration + admin hook and js sdk + dashboard (#14355)
* feat(): Translation settings + user configuration * feat(): Translation settings + user configuration * Create gentle-bees-grow.md * add entities end point * add entities end point * add admin hook and js sdk method * update changeset * fix tests * fix tests * rm unnecessary copy * update dashboard to use the new resources * update dashboard to use the new resources * update dashboard to use the new resources * allow type inference through interface augmentation in the defineConfig of medusa-config * allow type inference through interface augmentation in the defineConfig of medusa-config * exclude id and _id props --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
797878af26
commit
b21a599d11
@@ -161,6 +161,56 @@ export class Translation {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves a paginated list of entities for a given entity type with only their
|
||||
* translatable fields.
|
||||
* It sends a request to the
|
||||
* Get Translation Entities API route.
|
||||
*
|
||||
* @param query - The query parameters including the entity type and pagination configurations.
|
||||
* @param headers - Headers to pass in the request.
|
||||
* @returns The paginated list of entities with their translatable fields.
|
||||
*
|
||||
* @example
|
||||
* To retrieve the entities for a given entity type:
|
||||
*
|
||||
* ```ts
|
||||
* sdk.admin.translation.entities({
|
||||
* type: "product"
|
||||
* })
|
||||
* .then(({ data, count, offset, limit }) => {
|
||||
* console.log(data)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
||||
*
|
||||
* For example, to retrieve only 10 items and skip 10 items:
|
||||
*
|
||||
* ```ts
|
||||
* sdk.admin.translation.entities({
|
||||
* type: "product",
|
||||
* limit: 10,
|
||||
* offset: 10
|
||||
* })
|
||||
* .then(({ data, count, offset, limit }) => {
|
||||
* console.log(data)
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
async entities(
|
||||
query: HttpTypes.AdminTranslationEntitiesParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminTranslationEntitiesResponse>(
|
||||
`/admin/translations/entities`,
|
||||
{
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves the statistics for the translations for a given entity type or all entity types if no entity type is provided.
|
||||
* It sends a request to the
|
||||
|
||||
Reference in New Issue
Block a user