chore(docs): Generated Services Reference (automated) (#2399)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
35df4962f8
commit
23bf4eb192
615
docs/content/references/services/classes/PriceListService.md
Normal file
615
docs/content/references/services/classes/PriceListService.md
Normal file
@@ -0,0 +1,615 @@
|
||||
# Class: PriceListService
|
||||
|
||||
Provides layer to manipulate product tags.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`PriceListService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new PriceListService**(`__namedParameters`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `__namedParameters` | `PriceListConstructorProps` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:58](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L58)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
• `Protected` `Optional` `Readonly` **\_\_configModule\_\_**: `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/interfaces/transaction-base-service.ts:10](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/interfaces/transaction-base-service.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
• `Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/interfaces/transaction-base-service.ts:9](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/interfaces/transaction-base-service.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### customerGroupService\_
|
||||
|
||||
• `Protected` `Readonly` **customerGroupService\_**: [`CustomerGroupService`](CustomerGroupService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:49](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### featureFlagRouter\_
|
||||
|
||||
• `Protected` `Readonly` **featureFlagRouter\_**: `FlagRouter`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:56](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
• `Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:46](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### moneyAmountRepo\_
|
||||
|
||||
• `Protected` `Readonly` **moneyAmountRepo\_**: typeof `MoneyAmountRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:54](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### priceListRepo\_
|
||||
|
||||
• `Protected` `Readonly` **priceListRepo\_**: typeof `PriceListRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:53](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### productService\_
|
||||
|
||||
• `Protected` `Readonly` **productService\_**: [`ProductService`](ProductService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:51](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### productVariantRepo\_
|
||||
|
||||
• `Protected` `Readonly` **productVariantRepo\_**: typeof `ProductVariantRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:55](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
• `Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:50](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
• `Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:47](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
### variantService\_
|
||||
|
||||
• `Protected` `Readonly` **variantService\_**: [`ProductVariantService`](ProductVariantService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:52](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L52)
|
||||
|
||||
## Methods
|
||||
|
||||
### addCurrencyFromRegion
|
||||
|
||||
▸ `Protected` **addCurrencyFromRegion**<`T`\>(`prices`): `Promise`<`T`[]\>
|
||||
|
||||
Add `currency_code` to an MA record if `region_id`is passed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends `PriceListPriceUpdateInput` \| `PriceListPriceCreateInput` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `prices` | `T`[] | a list of PriceListPrice(Create/Update)Input records |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`T`[]\>
|
||||
|
||||
updated `prices` list
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:517](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L517)
|
||||
|
||||
___
|
||||
|
||||
### addPrices
|
||||
|
||||
▸ **addPrices**(`id`, `prices`, `replace?`): `Promise`<`PriceList`\>
|
||||
|
||||
Adds prices to a price list in bulk, optionally replacing all existing prices
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `id` | `string` | `undefined` | id of the price list |
|
||||
| `prices` | `PriceListPriceCreateInput`[] | `undefined` | prices to add |
|
||||
| `replace` | `boolean` | `false` | whether to replace existing prices |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PriceList`\>
|
||||
|
||||
updated Price List
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:216](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L216)
|
||||
|
||||
___
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
▸ `Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` |
|
||||
| `TError` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/interfaces/transaction-base-service.ts:50](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/interfaces/transaction-base-service.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### clearPrices
|
||||
|
||||
▸ **clearPrices**(`id`): `Promise`<`void`\>
|
||||
|
||||
Removes all prices from a price list and deletes the removed prices in bulk
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the price list |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
updated Price List
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:256](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L256)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
▸ **create**(`priceListObject`): `Promise`<`PriceList`\>
|
||||
|
||||
Creates a Price List
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `priceListObject` | `CreatePriceListInput` | the Price List to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PriceList`\>
|
||||
|
||||
created Price List
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:113](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
▸ **delete**(`id`): `Promise`<`void`\>
|
||||
|
||||
Deletes a Price List
|
||||
Will never fail due to delete being idempotent.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the price list |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:270](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L270)
|
||||
|
||||
___
|
||||
|
||||
### deletePrices
|
||||
|
||||
▸ **deletePrices**(`id`, `priceIds`): `Promise`<`void`\>
|
||||
|
||||
Removes prices from a price list and deletes the removed prices in bulk
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the price list |
|
||||
| `priceIds` | `string`[] | ids of the prices to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
updated Price List
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:241](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L241)
|
||||
|
||||
___
|
||||
|
||||
### deleteProductPrices
|
||||
|
||||
▸ **deleteProductPrices**(`priceListId`, `productIds`): `Promise`<[`string`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `priceListId` | `string` |
|
||||
| `productIds` | `string`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`string`[], `number`]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:444](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L444)
|
||||
|
||||
___
|
||||
|
||||
### deleteVariantPrices
|
||||
|
||||
▸ **deleteVariantPrices**(`priceListId`, `variantIds`): `Promise`<[`string`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `priceListId` | `string` |
|
||||
| `variantIds` | `string`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`string`[], `number`]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:481](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L481)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`PriceList`[]\>
|
||||
|
||||
Lists Price Lists
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterablePriceListProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`FilterablePriceListProps`\> | the config to be used for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PriceList`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:290](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L290)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config?`): `Promise`<[`PriceList`[], `number`]\>
|
||||
|
||||
Lists Price Lists and adds count
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterablePriceListProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`FilterablePriceListProps`\> | the config to be used for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PriceList`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:314](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L314)
|
||||
|
||||
___
|
||||
|
||||
### listProducts
|
||||
|
||||
▸ **listProducts**(`priceListId`, `selector?`, `config?`, `requiresPriceList?`): `Promise`<[`Product`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `priceListId` | `string` | `undefined` |
|
||||
| `selector` | `Selector`<`Product`\> \| `FilterableProductProps` | `{}` |
|
||||
| `config` | `FindConfig`<`Product`\> | `undefined` |
|
||||
| `requiresPriceList` | `boolean` | `false` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Product`[], `number`]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:362](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L362)
|
||||
|
||||
___
|
||||
|
||||
### listVariants
|
||||
|
||||
▸ **listVariants**(`priceListId`, `selector?`, `config?`, `requiresPriceList?`): `Promise`<[`ProductVariant`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `priceListId` | `string` | `undefined` |
|
||||
| `selector` | `FilterableProductVariantProps` | `{}` |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> | `undefined` |
|
||||
| `requiresPriceList` | `boolean` | `false` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProductVariant`[], `number`]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:410](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L410)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`priceListId`, `config?`): `Promise`<`PriceList`\>
|
||||
|
||||
Retrieves a product tag by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `priceListId` | `string` | the id of the product tag to retrieve |
|
||||
| `config` | `FindConfig`<`PriceList`\> | the config to retrieve the tag by |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PriceList`\>
|
||||
|
||||
the collection.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:89](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L89)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
▸ `Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `err` | `Record`<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/interfaces/transaction-base-service.ts:31](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/interfaces/transaction-base-service.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
▸ **update**(`id`, `update`): `Promise`<`PriceList`\>
|
||||
|
||||
Updates a Price List
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the Product List to update |
|
||||
| `update` | `UpdatePriceListInput` | the update to apply |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PriceList`\>
|
||||
|
||||
updated Price List
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:165](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L165)
|
||||
|
||||
___
|
||||
|
||||
### upsertCustomerGroups\_
|
||||
|
||||
▸ `Protected` **upsertCustomerGroups_**(`priceListId`, `customerGroups`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `priceListId` | `string` |
|
||||
| `customerGroups` | { `id`: `string` }[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/services/price-list.ts:343](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/services/price-list.ts#L343)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
▸ **withTransaction**(`transactionManager?`): [`PriceListService`](PriceListService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PriceListService`](PriceListService.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[packages/medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/35df4962f/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
Reference in New Issue
Block a user