Skip to content

Commit

Permalink
docs: fix bugs in API reference (#10557)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser authored Dec 11, 2024
1 parent 0264294 commit cccce65
Show file tree
Hide file tree
Showing 26 changed files with 91 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/carts/{id}/line-items' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"variant_id": "{value}",
"quantity": 3360689747918848,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"quantity": 8980402259623936,
"metadata": {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/carts/{id}/promotions' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"promo_codes": [
"{value}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/carts/{id}/shipping-methods' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"option_id": "{value}"
}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST '{backend_url}/store/customers' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"email": "[email protected]",
"company_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST '{backend_url}/store/customers/me' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"company_name": "{value}",
"first_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST '{backend_url}/store/customers/me/addresses' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"metadata": {},
"first_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
-H 'Authorization: Bearer {access_token}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"first_name": "{value}",
}'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/payment-collections' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"cart_id": "{value}"
}'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/payment-collections/{id}/payment-sessions' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"provider_id": "{value}"
}'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
curl -X POST '{backend_url}/store/return' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"order_id": "{value}",
"items": [
Expand Down
48 changes: 24 additions & 24 deletions www/apps/api-reference/specs/store/openapi.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/carts/{id}/line-items' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"variant_id": "{value}",
"quantity": 3360689747918848,
Expand Down Expand Up @@ -1007,8 +1007,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"quantity": 8980402259623936,
"metadata": {}
Expand Down Expand Up @@ -1167,8 +1167,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/carts/{id}/promotions' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"promo_codes": [
"{value}"
Expand Down Expand Up @@ -1303,8 +1303,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/carts/{id}/shipping-methods' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"option_id": "{value}"
}'
Expand Down Expand Up @@ -2252,8 +2252,8 @@ paths:
source: |-
curl -X POST '{backend_url}/store/customers' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"email": "[email protected]",
"company_name": "{value}",
Expand Down Expand Up @@ -2371,8 +2371,8 @@ paths:
source: |-
curl -X POST '{backend_url}/store/customers/me' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"company_name": "{value}",
"first_name": "{value}",
Expand Down Expand Up @@ -2625,8 +2625,8 @@ paths:
source: |-
curl -X POST '{backend_url}/store/customers/me/addresses' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"metadata": {},
"first_name": "{value}",
Expand Down Expand Up @@ -2815,8 +2815,8 @@ paths:
source: |-
curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"first_name": "{value}",
}'
Expand Down Expand Up @@ -2875,8 +2875,8 @@ paths:
- lang: Shell
label: cURL
source: |-
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
-H 'Authorization: Bearer {access_token}'
tags:
- Customers
Expand Down Expand Up @@ -3430,8 +3430,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/payment-collections' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"cart_id": "{value}"
}'
Expand Down Expand Up @@ -3494,8 +3494,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/payment-collections/{id}/payment-sessions' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"provider_id": "{value}"
}'
Expand Down Expand Up @@ -5451,8 +5451,8 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/store/return' \
-H 'Content-Type: application/json' \ \
-H 'x-publishable-api-key: {your_publishable_api_key}'
-H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"order_id": "{value}",
"items": [
Expand Down
23 changes: 19 additions & 4 deletions www/packages/docs-ui/src/components/CodeTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,30 @@ export const CodeTabs = ({
return
}

const codeBlockProps = codeBlock.props as CodeBlockProps
let codeBlockProps = codeBlock.props as CodeBlockProps

const commonProps = {
badgeLabel: undefined,
hasTabs: true,
className: clsx("!my-0", codeBlockProps.className),
}

if (
typeof codeBlock.type !== "string" &&
"name" in codeBlock.type &&
codeBlock.type.name === "CodeBlock"
) {
codeBlockProps = {
...codeBlockProps,
...commonProps,
}
}

const modifiedProps: CodeBlockProps = {
...(getCodeBlockProps(codeBlock) || {
source: "",
}),
badgeLabel: undefined,
hasTabs: true,
className: clsx("!my-0", codeBlockProps.className),
...commonProps,
}

tempTabs.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* - lang: Shell
* label: cURL
* source: |-
* curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* -H 'Authorization: Bearer {access_token}'
* tags:
* - Customers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/store/carts/{id}/line-items' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "variant_id": "{value}",
* "quantity": 3360689747918848,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "quantity": 8980402259623936,
* "metadata": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/store/carts/{id}/promotions' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "promo_codes": [
* "{value}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/store/carts/{id}/shipping-methods' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "option_id": "{value}"
* }'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* source: |-
* curl -X POST '{backend_url}/store/customers' \
* -H 'Authorization: Bearer {token}' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "email": "Monserrate.Leannon88@yahoo.com",
* "company_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* source: |-
* curl -X POST '{backend_url}/store/customers/me' \
* -H 'Authorization: Bearer {access_token}' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "company_name": "{value}",
* "first_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
* source: |-
* curl -X POST '{backend_url}/store/customers/me/addresses' \
* -H 'Authorization: Bearer {access_token}' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "metadata": {},
* "first_name": "{value}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
* source: |-
* curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}' \
* -H 'Authorization: Bearer {access_token}' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "first_name": "{value}",
* }'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/store/payment-collections' \
* -H 'Content-Type: application/json' \ \
* -H 'x-publishable-api-key: {your_publishable_api_key}'
* -H 'Content-Type: application/json' \
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
* --data-raw '{
* "cart_id": "{value}"
* }'
Expand Down
Loading

0 comments on commit cccce65

Please sign in to comment.