docs: update Typedoc and regenerate references (#1994)
* generated new services reference * changed from automatic push to automated pull request * updated typedoc, regenerated JS Client reference * regenerated the reference after updating typedoc * added action for js client
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Class: SwapService
|
||||
|
||||
Handles swaps
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -24,7 +26,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:21](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L21)
|
||||
[packages/medusa/src/services/swap.js:21](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L21)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -48,7 +50,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:9](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L9)
|
||||
[packages/medusa/src/services/swap.js:9](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L9)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -56,19 +58,25 @@ BaseService.constructor
|
||||
|
||||
▸ **cancel**(`swapId`): `Promise`<`Swap`\>
|
||||
|
||||
Cancels a given swap if possible. A swap can only be canceled if all
|
||||
related returns, fulfillments, and payments have been canceled. If a swap
|
||||
is associated with a refund, it cannot be canceled.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | |
|
||||
| `swapId` | `string` | the id of the swap to cancel. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the canceled swap.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:790](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L790)
|
||||
[packages/medusa/src/services/swap.js:792](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L792)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,19 +84,23 @@ ___
|
||||
|
||||
▸ **cancelFulfillment**(`fulfillmentId`): `Swap`
|
||||
|
||||
Cancels a fulfillment (if related to a swap)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fulfillmentId` | `string` | |
|
||||
| `fulfillmentId` | `string` | the ID of the fulfillment to cancel |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Swap`
|
||||
|
||||
updated swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:983](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L983)
|
||||
[packages/medusa/src/services/swap.js:985](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L985)
|
||||
|
||||
___
|
||||
|
||||
@@ -96,23 +108,28 @@ ___
|
||||
|
||||
▸ **create**(`order`, `returnItems`, `additionalItems`, `returnShipping`, `custom?`): `Promise`<`Swap`\>
|
||||
|
||||
Creates a swap from an order, with given return items, additional items
|
||||
and an optional return shipping method.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | |
|
||||
| `returnItems` | `ReturnItem`[] | |
|
||||
| `additionalItems` | `undefined` \| `PreliminaryLineItem`[] | |
|
||||
| `returnShipping` | `any` | |
|
||||
| `custom` | `any` | |
|
||||
| `order` | `Order` | the order to base the swap off. |
|
||||
| `returnItems` | `ReturnItem`[] | the items to return in the swap. |
|
||||
| `additionalItems` | `undefined` \| `PreliminaryLineItem`[] | the items to send to the customer. |
|
||||
| `returnShipping` | `any` | an optional shipping method for returning the returnItems. |
|
||||
| `custom` | `any` | contains relevant custom information. This object may include no_notification which will disable sending notification when creating swap. If set, it overrules the attribute inherited from the order. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the newly created swap.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:313](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L313)
|
||||
[packages/medusa/src/services/swap.js:315](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L315)
|
||||
|
||||
___
|
||||
|
||||
@@ -120,20 +137,28 @@ ___
|
||||
|
||||
▸ **createCart**(`swapId`, `customShippingOptions?`): `Promise`<`Swap`\>
|
||||
|
||||
Creates a cart from the given swap and order. The cart can be used to pay
|
||||
for differences associated with the swap. The swap represented by the
|
||||
swapId must belong to the order. Fails if there is already a cart on the
|
||||
swap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `swapId` | `string` | `undefined` | |
|
||||
| `customShippingOptions` | `any`[] | `[]` | |
|
||||
| `swapId` | `string` | `undefined` | the id of the swap to create the cart from |
|
||||
| `customShippingOptions` | `any`[] | `[]` | the shipping options |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap with its cart_id prop set to the id of
|
||||
the new cart.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:544](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L544)
|
||||
[packages/medusa/src/services/swap.js:546](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L546)
|
||||
|
||||
___
|
||||
|
||||
@@ -141,20 +166,25 @@ ___
|
||||
|
||||
▸ **createFulfillment**(`swapId`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Fulfills the addtional items associated with the swap. Will call the
|
||||
fulfillment providers associated with the shipping methods.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
| `swapId` | `string` | the id of the swap to fulfill, |
|
||||
| `config` | `any` | optional configurations, includes optional metadata to attach to the shipment, and a no_notification flag. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the updated swap with new status and fulfillments.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:848](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L848)
|
||||
[packages/medusa/src/services/swap.js:850](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L850)
|
||||
|
||||
___
|
||||
|
||||
@@ -162,22 +192,26 @@ ___
|
||||
|
||||
▸ **createShipment**(`swapId`, `fulfillmentId`, `trackingLinks`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Marks a fulfillment as shipped and attaches tracking numbers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | |
|
||||
| `fulfillmentId` | `string` | |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | |
|
||||
| `config` | `any` | |
|
||||
| `swapId` | `string` | the id of the swap that has been shipped. |
|
||||
| `fulfillmentId` | `string` | the id of the specific fulfillment that has been shipped |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | the tracking numbers associated with the shipment |
|
||||
| `config` | `any` | optional configurations, includes optional metadata to attach to the shipment, and a noNotification flag. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the updated swap with new fulfillments and status.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1016](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1016)
|
||||
[packages/medusa/src/services/swap.js:1018](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L1018)
|
||||
|
||||
___
|
||||
|
||||
@@ -185,20 +219,24 @@ ___
|
||||
|
||||
▸ **deleteMetadata**(`swapId`, `key`): `Promise`<`any`\>
|
||||
|
||||
Dedicated method to delete metadata for a swap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | |
|
||||
| `key` | `string` | |
|
||||
| `swapId` | `string` | the order to delete metadata from. |
|
||||
| `key` | `string` | key for metadata field |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the updated result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1089](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1089)
|
||||
[packages/medusa/src/services/swap.js:1091](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L1091)
|
||||
|
||||
___
|
||||
|
||||
@@ -210,16 +248,18 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:238](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L238)
|
||||
[packages/medusa/src/services/swap.js:240](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L240)
|
||||
|
||||
___
|
||||
|
||||
@@ -239,7 +279,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:395](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L395)
|
||||
[packages/medusa/src/services/swap.js:397](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L397)
|
||||
|
||||
___
|
||||
|
||||
@@ -251,7 +291,7 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | |
|
||||
| `swapId` | `string` | The id of the swap |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -259,7 +299,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:659](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L659)
|
||||
[packages/medusa/src/services/swap.js:661](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L661)
|
||||
|
||||
___
|
||||
|
||||
@@ -267,19 +307,24 @@ ___
|
||||
|
||||
▸ **registerReceived**(`id`): `Promise`<`Order`\>
|
||||
|
||||
Registers the swap return items as received so that they cannot be used
|
||||
as a part of other swaps/returns.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | |
|
||||
| `id` | `string` | the id of the order with the swap. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the resulting order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1114)
|
||||
[packages/medusa/src/services/swap.js:1116](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L1116)
|
||||
|
||||
___
|
||||
|
||||
@@ -287,20 +332,24 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Retrieves a swap with the given id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
| `id` | `string` | the id of the swap to retrieve |
|
||||
| `config` | `any` | the configuration to retrieve the swap |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:181](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L181)
|
||||
[packages/medusa/src/services/swap.js:181](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L181)
|
||||
|
||||
___
|
||||
|
||||
@@ -308,20 +357,24 @@ ___
|
||||
|
||||
▸ **retrieveByCartId**(`cartId`, `relations?`): `Promise`<`Swap`\>
|
||||
|
||||
Retrieves a swap based on its associated cart id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `cartId` | `string` | `undefined` | |
|
||||
| `relations` | `string`[] | `[]` | |
|
||||
| `cartId` | `string` | `undefined` | the cart id that the swap's cart has |
|
||||
| `relations` | `string`[] | `[]` | the relations to retrieve swap |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:216](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L216)
|
||||
[packages/medusa/src/services/swap.js:218](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L218)
|
||||
|
||||
___
|
||||
|
||||
@@ -341,7 +394,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L114)
|
||||
[packages/medusa/src/services/swap.js:114](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L114)
|
||||
|
||||
___
|
||||
|
||||
@@ -362,7 +415,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:511](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L511)
|
||||
[packages/medusa/src/services/swap.js:513](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L513)
|
||||
|
||||
___
|
||||
|
||||
@@ -370,20 +423,26 @@ ___
|
||||
|
||||
▸ **validateReturnItems_**(`order`, `returnItems`): `ReturnItems`[]
|
||||
|
||||
Goes through a list of return items to ensure that they exist on the
|
||||
original order. If the item exists it is verified that the quantity to
|
||||
return is not higher than the original quantity ordered.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `OrderLike` | |
|
||||
| `returnItems` | `ReturnItem`[] | |
|
||||
| `order` | `OrderLike` | the order to return from |
|
||||
| `returnItems` | `ReturnItem`[] | the items to return |
|
||||
|
||||
#### Returns
|
||||
|
||||
`ReturnItems`[]
|
||||
|
||||
the validated returnItems
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:269](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L269)
|
||||
[packages/medusa/src/services/swap.js:271](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L271)
|
||||
|
||||
___
|
||||
|
||||
@@ -403,4 +462,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:86](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L86)
|
||||
[packages/medusa/src/services/swap.js:86](https://github.com/medusajs/medusa/blob/f406c8d4/packages/medusa/src/services/swap.js#L86)
|
||||
|
||||
Reference in New Issue
Block a user