Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@ const generatedgeneratedAdminSidebarSidebar = {
"loaded": false,
"showLoadingIfEmpty": true
},
{
"type": "category",
"title": "Rbac",
"children": [],
"loaded": false,
"showLoadingIfEmpty": true
},
{
"type": "category",
"title": "Refund Reasons",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export const sdk = new Medusa({
sdk.admin.translation.settings({
entity_type: "product"
})
.then(({ translatable_fields }) => {
console.log(translatable_fields)
.then(({ translation_settings }) => {
console.log(translation_settings)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Medusa from "@medusajs/js-sdk"

export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})

sdk.admin.translation.batchSettings({
create: [
{
entity_type: "product",
fields: ["title", "description"],
is_active: true
}
],
update: [
{
id: "trset_123",
fields: ["title", "description", "subtitle"],
is_active: true
}
],
delete: ["trset_456"]
})
.then(({ created, updated, deleted }) => {
console.log(created, updated, deleted)
})
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Markdown code fence accidentally included in JavaScript code sample

Low Severity

A markdown code fence (```) was accidentally included at the end of the JavaScript code sample for the POST /admin/translations/settings/batch endpoint. This invalid JavaScript syntax will be displayed to users viewing the API documentation, making the code sample appear broken and potentially confusing developers trying to use it.

Additional Locations (1)

Fix in Cursor Fix in Web

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST '{backend_url}/admin/translations/settings/batch' \
-H 'Authorization: Bearer {access_token}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type: object
description: The translation settings to create, update, or delete in batch.
x-schemaName: AdminBatchTranslationSettings
properties:
create:
type: array
description: The translation settings to create.
items:
$ref: ./AdminCreateTranslationSettings.yaml
update:
type: array
description: The translation settings to update.
items:
$ref: ./AdminUpdateTranslationSettings.yaml
delete:
type: array
description: The translation settings to delete.
items:
type: string
title: delete
description: The IDs of the translation settings to delete.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
type: object
description: The result of managing the translation settings in batch.
x-schemaName: AdminBatchTranslationSettingsResponse
required:
- created
- updated
- deleted
properties:
created:
type: array
description: The created translation settings.
items:
$ref: ./AdminTranslationSettings.yaml
updated:
type: array
description: The updated translation settings.
items:
$ref: ./AdminTranslationSettings.yaml
deleted:
type: object
description: The deletion result.
required:
- ids
- object
- deleted
properties:
ids:
type: array
description: The IDs of the deleted translation settings.
items:
type: string
title: ids
description: The ID of a deleted translation settings.
object:
type: string
title: object
description: The type of object deleted.
deleted:
type: boolean
title: deleted
description: Whether the deletion was successful.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type: object
description: The translation settings to create.
x-schemaName: AdminCreateTranslationSettings
required:
- entity_type
- fields
properties:
entity_type:
type: string
title: entity_type
description: The entity type to create the translation settings for.
example: product
fields:
type: array
description: The fields to support translations for.
items:
type: string
title: fields
description: A field to support translations for.
example: title
is_active:
type: boolean
title: is_active
description: Whether translations are active for the given entity type.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
type: object
description: The translation settings details.
x-schemaName: AdminTranslationSettings
required:
- id
- created_at
- updated_at
- deleted_at
- entity_type
- fields
- is_active
properties:
id:
type: string
title: id
description: The ID of the translation settings.
created_at:
type: string
format: date-time
title: created_at
description: The date the translation settings was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the translation settings was updated.
deleted_at:
type: string
format: date-time
title: deleted_at
description: The date the translation settings was deleted.
entity_type:
type: string
title: entity_type
description: The entity type the translation settings are for.
example: product
fields:
type: array
description: The fields supported for translations.
items:
type: string
title: fields
description: A field supported for translations.
is_active:
type: boolean
title: is_active
description: Whether translations are active for the given entity type.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@ type: object
description: The translation settings' details.
x-schemaName: AdminTranslationSettingsResponse
required:
- translatable_fields
- translation_settings
properties:
translatable_fields:
translation_settings:
type: object
description: >-
Key-value pairs of translatable fields for different entities. Each key is
an entity type, and the value is an array of fields that can be translated
for that entity.
example:
product:
- title
- description
description: The translation settings details.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
type: object
description: The translation settings to update.
x-schemaName: AdminUpdateTranslationSettings
required:
- id
properties:
id:
type: string
title: id
description: The ID of the translation settings to update.
entity_type:
type: string
title: entity_type
description: The entity type to update the translation settings for.
fields:
type: array
description: The fields to update translations for.
items:
type: string
title: fields
description: A field to update translations for.
is_active:
type: boolean
title: is_active
description: Whether translations are active for the given entity type.
Loading
Loading