chore(docs): Generated API Reference (#5259)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
1 parent
22130ecb63
commit
68915bee86
439 files changed
+696
-398
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.store.auth.getToken({
|
||||
email: 'user@example.com',
|
||||
password: 'supersecret'
|
||||
})
|
||||
.then(({ accessToken }) => {
|
||||
console.log(accessToken);
|
||||
});
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
curl '{backend_url}/store/product-categories' \
|
||||
-H 'Authorization: Bearer {api_token}'
|
||||
-H 'x-medusa-access-token: {api_token}'
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
curl '{backend_url}/store/product-categories/{id}' \
|
||||
-H 'Authorization: Bearer {api_token}'
|
||||
-H 'x-medusa-access-token: {api_token}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl --location --request POST 'https://medusa-url.com/store/auth/token' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret"
|
||||
}'
|
||||
@@ -0,0 +1,5 @@
|
||||
type: object
|
||||
properties:
|
||||
accessToken:
|
||||
description: Access token for subsequent authorization.
|
||||
type: string
|
||||
@@ -262,12 +262,18 @@ paths:
|
||||
$ref: paths/store_swaps.yaml
|
||||
/store/swaps/{cart_id}:
|
||||
$ref: paths/store_swaps_{cart_id}.yaml
|
||||
/store/token:
|
||||
$ref: paths/store_token.yaml
|
||||
/store/variants:
|
||||
$ref: paths/store_variants.yaml
|
||||
/store/variants/{id}:
|
||||
$ref: paths/store_variants_{id}.yaml
|
||||
components:
|
||||
securitySchemes:
|
||||
jwt_token:
|
||||
type: http
|
||||
x-displayName: JWT Token
|
||||
scheme: bearer
|
||||
cookie_auth:
|
||||
type: apiKey
|
||||
x-displayName: Cookie Session ID
|
||||
|
||||
@@ -16,6 +16,7 @@ get:
|
||||
$ref: ../code_samples/Shell/store_auth/get.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Auth
|
||||
responses:
|
||||
@@ -96,6 +97,7 @@ delete:
|
||||
$ref: ../code_samples/Shell/store_auth/delete.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Auth
|
||||
responses:
|
||||
|
||||
@@ -16,6 +16,7 @@ get:
|
||||
$ref: ../code_samples/Shell/store_customers_me/get.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
@@ -60,6 +61,7 @@ post:
|
||||
$ref: ../code_samples/Shell/store_customers_me/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
|
||||
@@ -21,6 +21,7 @@ post:
|
||||
$ref: ../code_samples/Shell/store_customers_me_addresses/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ post:
|
||||
../code_samples/Shell/store_customers_me_addresses_{address_id}/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
@@ -79,6 +80,7 @@ delete:
|
||||
../code_samples/Shell/store_customers_me_addresses_{address_id}/delete.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
|
||||
@@ -210,6 +210,7 @@ get:
|
||||
$ref: ../code_samples/Shell/store_customers_me_orders/get.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
|
||||
@@ -22,6 +22,7 @@ get:
|
||||
$ref: ../code_samples/Shell/store_customers_me_payment-methods/get.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Customers
|
||||
responses:
|
||||
|
||||
@@ -32,6 +32,7 @@ post:
|
||||
security:
|
||||
- api_token: []
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Orders
|
||||
responses:
|
||||
|
||||
@@ -26,6 +26,7 @@ post:
|
||||
security:
|
||||
- api_token: []
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Orders
|
||||
responses:
|
||||
|
||||
@@ -38,6 +38,7 @@ get:
|
||||
$ref: ../code_samples/Shell/store_payment-collections_{id}/get.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
@@ -29,6 +29,7 @@ post:
|
||||
$ref: ../code_samples/Shell/store_payment-collections_{id}_sessions/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ post:
|
||||
../code_samples/Shell/store_payment-collections_{id}_sessions_batch/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ post:
|
||||
../code_samples/Shell/store_payment-collections_{id}_sessions_batch_authorize/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ post:
|
||||
../code_samples/Shell/store_payment-collections_{id}_sessions_{session_id}/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ post:
|
||||
../code_samples/Shell/store_payment-collections_{id}_sessions_{session_id}_authorize/post.sh
|
||||
security:
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Payment Collections
|
||||
responses:
|
||||
|
||||
@@ -77,6 +77,7 @@ get:
|
||||
security:
|
||||
- api_token: []
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Product Categories
|
||||
responses:
|
||||
|
||||
@@ -39,6 +39,7 @@ get:
|
||||
security:
|
||||
- api_token: []
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Product Categories
|
||||
responses:
|
||||
|
||||
@@ -113,6 +113,7 @@ get:
|
||||
security:
|
||||
- api_token: []
|
||||
- cookie_auth: []
|
||||
- jwt_token: []
|
||||
tags:
|
||||
- Product Types
|
||||
responses:
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
post:
|
||||
operationId: PostToken
|
||||
summary: Customer Login (JWT)
|
||||
x-authenticated: false
|
||||
description: >-
|
||||
After a successful login, a JWT token is returned for subsequent
|
||||
authorization.
|
||||
parameters: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
description: The User's email.
|
||||
password:
|
||||
type: string
|
||||
description: The User's password.
|
||||
x-codegen:
|
||||
method: getToken
|
||||
x-codeSamples:
|
||||
- lang: JavaScript
|
||||
label: JS Client
|
||||
source:
|
||||
$ref: ../code_samples/JavaScript/store_token/post.js
|
||||
- lang: Shell
|
||||
label: cURL
|
||||
source:
|
||||
$ref: ../code_samples/Shell/store_token/post.sh
|
||||
tags:
|
||||
- Auth
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas/StoreBearerAuthRes.yaml
|
||||
'400':
|
||||
$ref: ../components/responses/400_error.yaml
|
||||
'401':
|
||||
$ref: ../components/responses/incorrect_credentials.yaml
|
||||
'404':
|
||||
$ref: ../components/responses/not_found_error.yaml
|
||||
'409':
|
||||
$ref: ../components/responses/invalid_state_error.yaml
|
||||
'422':
|
||||
$ref: ../components/responses/invalid_request_error.yaml
|
||||
'500':
|
||||
$ref: ../components/responses/500_error.yaml
|
||||
Reference in new issue
Block a user