docs: update OAS for loyalty plugin (#12836)

* updates

* cleanup

* generate OAS

* update links
This commit is contained in:
Shahed Nasser
2025-06-26 17:22:18 +03:00
committed by GitHub
parent 2983c7c3a5
commit 7d95eb73d3
81 changed files with 463 additions and 2001 deletions

View File

@@ -0,0 +1,2 @@
curl '{backend_url}/admin/gift-cards/{id}/orders' \
-H 'Authorization: Bearer {access_token}'

View File

@@ -1,6 +0,0 @@
curl -X POST '{backend_url}/admin/gift-cards/{id}/transfer' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
--data-raw '{
"customer_id": "{value}"
}'

View File

@@ -4,7 +4,6 @@ x-schemaName: AdminGiftCard
required:
- line_item
- customer
- invitation
- id
- code
- status
@@ -65,8 +64,6 @@ properties:
type: string
title: expires_at
description: The date the gift card expires at.
invitation:
$ref: ./AdminGiftCardInvitation.yaml
created_at:
type: string
format: date-time

View File

@@ -1,37 +0,0 @@
type: object
description: The gift card invitation details.
required:
- gift_card
- id
- code
- status
- expires_at
- email
properties:
id:
type: string
title: id
description: The invitation's ID.
email:
type: string
title: email
description: The invitation's email.
format: email
code:
type: string
title: code
description: The invitation's code.
status:
type: string
description: The invitation's status.
enum:
- pending
- accepted
- rejected
expires_at:
type: string
title: expires_at
description: The date the invitation expires at.
gift_card:
type: object
x-schemaName: AdminGiftCardInvitation

View File

@@ -24,3 +24,8 @@ properties:
description: The list of gift cards.
items:
$ref: ./AdminGiftCard.yaml
estimate_count:
type: number
title: estimate_count
description: The gift card's estimate count.
x-featureFlag: index_engine

View File

@@ -24,3 +24,8 @@ properties:
description: The list of store credit accounts.
items:
$ref: ./AdminStoreCreditAccount.yaml
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine

View File

@@ -24,3 +24,8 @@ properties:
description: The list of transaction groups.
items:
$ref: ./AdminTransactionGroup.yaml
estimate_count:
type: number
title: estimate_count
description: The transaction group's estimate count.
x-featureFlag: index_engine

View File

@@ -24,3 +24,8 @@ properties:
description: The list of transactions.
items:
$ref: ./AdminTransaction.yaml
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine

View File

@@ -1,10 +0,0 @@
type: object
description: The details of the gift card transfer request.
x-schemaName: AdminTransferGiftCard
required:
- customer_id
properties:
customer_id:
type: string
title: customer_id
description: The ID of the customer to transfer the gift card to.

View File

@@ -1,16 +0,0 @@
type: object
description: The details to create a gift card invitation.
x-schemaName: StoreCreateGiftCardInvitation
required:
- email
properties:
email:
type: string
title: email
description: The email address to send the gift card invitation to.
format: email
expires_at:
type: string
title: expires_at
description: The date the gift card invitation expires.
format: date-time

View File

@@ -4,7 +4,6 @@ x-schemaName: StoreGiftCard
required:
- customer
- line_item
- invitation
- id
- code
- status
@@ -20,6 +19,12 @@ required:
properties:
customer:
$ref: ./StoreCustomer.yaml
line_item:
$ref: ./StoreOrderLineItem.yaml
id:
type: string
title: id
description: The gift card's ID.
code:
type: string
title: code
@@ -34,22 +39,32 @@ properties:
type: number
title: value
description: The gift card's amount.
currency_code:
type: string
title: currency_code
description: The gift card's currency code.
example: usd
customer_id:
type: string
title: customer_id
description: The ID of the customer that the gift card belongs to.
id:
type: string
title: id
description: The gift card's ID.
reference_id:
type: string
title: reference_id
description: The gift card's reference ID.
note:
type: string
title: note
description: A note with more information about the gift card.
reference:
type: string
title: reference
description: The gift card's reference.
expires_at:
type: string
title: expires_at
description: The date the gift card expires.
format: date-time
created_at:
type: string
format: date-time
@@ -60,20 +75,3 @@ properties:
format: date-time
title: updated_at
description: The date the gift card was updated.
currency_code:
type: string
title: currency_code
description: The gift card's currency code.
example: usd
note:
type: string
title: note
description: The gift card's note.
expires_at:
type: string
title: expires_at
description: The date the gift card expires.
invitation:
type: object
line_item:
$ref: ./StoreOrderLineItem.yaml

View File

@@ -1,8 +0,0 @@
type: object
description: The gift card invitation's details.
x-schemaName: StoreGiftCardInvitationResponse
required:
- gift_card_invitation
properties:
gift_card_invitation:
$ref: ./StoreGiftCardInvitation.yaml

View File

@@ -24,3 +24,8 @@ properties:
description: The list of store credit accounts.
items:
$ref: ./StoreStoreCreditAccount.yaml
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine

View File

@@ -20123,6 +20123,65 @@ paths:
- text: Cloud
description: |
This API route is only available in [Medusa Cloud](https://docs.medusajs.com/cloud/loyalty-plugin).
/admin/gift-cards/{id}/orders:
get:
operationId: GetGiftCardsIdOrders
summary: List Gift Card's Orders
x-sidebar-summary: List Orders
description: Retrieve the list of orders that a gift card was used in.
x-authenticated: true
x-ignoreCleanup: true
parameters:
- name: id
in: path
description: The gift card's ID.
required: true
schema:
type: string
- name: fields
in: query
description: |-
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.
required: false
schema:
type: string
title: fields
description: 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.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
- jwt_token: []
x-codeSamples:
- lang: Shell
label: cURL
source: |-
curl '{backend_url}/admin/gift-cards/{id}/orders' \
-H 'Authorization: Bearer {access_token}'
tags:
- Gift Cards
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
x-badges:
- text: Cloud
description: |
This API route is only available in [Medusa Cloud](https://docs.medusajs.com/cloud/loyalty-plugin).
/admin/gift-cards/{id}/redeem:
post:
operationId: PostGiftCardsIdRedeem
@@ -20194,77 +20253,6 @@ paths:
- text: Cloud
description: |
This API route is only available in [Medusa Cloud](https://docs.medusajs.com/cloud/loyalty-plugin).
/admin/gift-cards/{id}/transfer:
post:
operationId: PostGiftCardsIdTransfer
summary: Transfer Gift Card
description: Transfer a gift card to another customer.
x-authenticated: true
x-ignoreCleanup: true
parameters:
- name: id
in: path
description: The gift card's ID.
required: true
schema:
type: string
- name: fields
in: query
description: |-
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.
required: false
schema:
type: string
title: fields
description: 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.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
- jwt_token: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTransferGiftCard'
x-codeSamples:
- lang: Shell
label: cURL
source: |-
curl -X POST '{backend_url}/admin/gift-cards/{id}/transfer' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
--data-raw '{
"customer_id": "{value}"
}'
tags:
- Gift Cards
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardResponse'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
x-badges:
- text: Cloud
description: |
This API route is only available in [Medusa Cloud](https://docs.medusajs.com/cloud/loyalty-plugin).
/admin/inventory-items:
get:
operationId: GetInventoryItems
@@ -60112,7 +60100,6 @@ components:
required:
- line_item
- customer
- invitation
- id
- code
- status
@@ -60173,8 +60160,6 @@ components:
type: string
title: expires_at
description: The date the gift card expires at.
invitation:
$ref: '#/components/schemas/AdminGiftCardInvitation'
created_at:
type: string
format: date-time
@@ -60185,44 +60170,6 @@ components:
format: date-time
title: updated_at
description: The date the gift card was updated at.
AdminGiftCardInvitation:
type: object
description: The gift card invitation details.
required:
- gift_card
- id
- code
- status
- expires_at
- email
properties:
id:
type: string
title: id
description: The invitation's ID.
email:
type: string
title: email
description: The invitation's email.
format: email
code:
type: string
title: code
description: The invitation's code.
status:
type: string
description: The invitation's status.
enum:
- pending
- accepted
- rejected
expires_at:
type: string
title: expires_at
description: The date the invitation expires at.
gift_card:
type: object
x-schemaName: AdminGiftCardInvitation
AdminGiftCardResponse:
type: object
description: The gift card's details.
@@ -60259,6 +60206,11 @@ components:
description: The list of gift cards.
items:
$ref: '#/components/schemas/AdminGiftCard'
estimate_count:
type: number
title: estimate_count
description: The gift card's estimate count.
x-featureFlag: index_engine
AdminImportProductRequest:
type: object
description: The import's details.
@@ -66483,6 +66435,11 @@ components:
description: The list of store credit accounts.
items:
$ref: '#/components/schemas/AdminStoreCreditAccount'
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine
AdminStoreCurrency:
type: object
description: The details of a store's currency.
@@ -66951,6 +66908,11 @@ components:
description: The list of transaction groups.
items:
$ref: '#/components/schemas/AdminTransactionGroup'
estimate_count:
type: number
title: estimate_count
description: The transaction group's estimate count.
x-featureFlag: index_engine
AdminTransactionsResponse:
type: object
description: The paginated list of transactions.
@@ -66978,17 +66940,11 @@ components:
description: The list of transactions.
items:
$ref: '#/components/schemas/AdminTransaction'
AdminTransferGiftCard:
type: object
description: The details of the gift card transfer request.
x-schemaName: AdminTransferGiftCard
required:
- customer_id
properties:
customer_id:
type: string
title: customer_id
description: The ID of the customer to transfer the gift card to.
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine
AdminTransferOrder:
type: object
description: The details of the request to transfer the order.
@@ -75420,23 +75376,6 @@ components:
metadata:
type: object
description: The customer's metadata, can hold custom key-value pairs.
StoreCreateGiftCardInvitation:
type: object
description: The details to create a gift card invitation.
x-schemaName: StoreCreateGiftCardInvitation
required:
- email
properties:
email:
type: string
title: email
description: The email address to send the gift card invitation to.
format: email
expires_at:
type: string
title: expires_at
description: The date the gift card invitation expires.
format: date-time
StoreCreatePaymentCollection:
type: object
description: The details of the payment collection to create.
@@ -75855,7 +75794,6 @@ components:
required:
- customer
- line_item
- invitation
- id
- code
- status
@@ -75871,6 +75809,12 @@ components:
properties:
customer:
$ref: '#/components/schemas/StoreCustomer'
line_item:
$ref: '#/components/schemas/StoreOrderLineItem'
id:
type: string
title: id
description: The gift card's ID.
code:
type: string
title: code
@@ -75885,22 +75829,32 @@ components:
type: number
title: value
description: The gift card's amount.
currency_code:
type: string
title: currency_code
description: The gift card's currency code.
example: usd
customer_id:
type: string
title: customer_id
description: The ID of the customer that the gift card belongs to.
id:
type: string
title: id
description: The gift card's ID.
reference_id:
type: string
title: reference_id
description: The gift card's reference ID.
note:
type: string
title: note
description: A note with more information about the gift card.
reference:
type: string
title: reference
description: The gift card's reference.
expires_at:
type: string
title: expires_at
description: The date the gift card expires.
format: date-time
created_at:
type: string
format: date-time
@@ -75911,23 +75865,6 @@ components:
format: date-time
title: updated_at
description: The date the gift card was updated.
currency_code:
type: string
title: currency_code
description: The gift card's currency code.
example: usd
note:
type: string
title: note
description: The gift card's note.
expires_at:
type: string
title: expires_at
description: The date the gift card expires.
invitation:
type: object
line_item:
$ref: '#/components/schemas/StoreOrderLineItem'
StoreGiftCardInvitation:
type: object
description: The gift card invitation's details.
@@ -75953,15 +75890,6 @@ components:
description: The gift card invitation's status.
gift_card:
$ref: '#/components/schemas/StoreGiftCard'
StoreGiftCardInvitationResponse:
type: object
description: The gift card invitation's details.
x-schemaName: StoreGiftCardInvitationResponse
required:
- gift_card_invitation
properties:
gift_card_invitation:
$ref: '#/components/schemas/StoreGiftCardInvitation'
StoreGiftCardResponse:
type: object
description: The gift card's details.
@@ -83557,6 +83485,11 @@ components:
description: The list of store credit accounts.
items:
$ref: '#/components/schemas/StoreStoreCreditAccount'
estimate_count:
type: number
title: estimate_count
description: The store credit account's estimate count.
x-featureFlag: index_engine
StoreTransactionGroup:
type: object
description: The transaction group's details.

View File

@@ -848,10 +848,10 @@ paths:
$ref: paths/admin_gift-cards.yaml
/admin/gift-cards/{id}:
$ref: paths/admin_gift-cards_{id}.yaml
/admin/gift-cards/{id}/orders:
$ref: paths/admin_gift-cards_{id}_orders.yaml
/admin/gift-cards/{id}/redeem:
$ref: paths/admin_gift-cards_{id}_redeem.yaml
/admin/gift-cards/{id}/transfer:
$ref: paths/admin_gift-cards_{id}_transfer.yaml
/admin/inventory-items:
$ref: paths/admin_inventory-items.yaml
/admin/inventory-items/location-levels/batch:

View File

@@ -1,7 +1,8 @@
post:
operationId: PostGiftCardsIdTransfer
summary: Transfer Gift Card
description: Transfer a gift card to another customer.
get:
operationId: GetGiftCardsIdOrders
summary: List Gift Card's Orders
x-sidebar-summary: List Orders
description: Retrieve the list of orders that a gift card was used in.
x-authenticated: true
x-ignoreCleanup: true
parameters:
@@ -13,13 +14,10 @@ post:
type: string
- name: fields
in: query
description: >-
description: |-
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.
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.
required: false
schema:
type: string
@@ -35,25 +33,16 @@ post:
- api_token: []
- cookie_auth: []
- jwt_token: []
requestBody:
content:
application/json:
schema:
$ref: ../components/schemas/AdminTransferGiftCard.yaml
x-codeSamples:
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/admin_gift-cards_{id}_transfer/post.sh
$ref: ../code_samples/Shell/admin_gift-cards_{id}_orders/get.sh
tags:
- Gift Cards
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../components/schemas/AdminGiftCardResponse.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':