docs: updated services reference (#1809)
This commit is contained in:
@@ -4,7 +4,7 @@ Provides layer to manipulate gift cards.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
- `TransactionBaseService`<[`GiftCardService`](GiftCardService.md)\>
|
||||
|
||||
↳ **`GiftCardService`**
|
||||
|
||||
@@ -18,18 +18,106 @@ Provides layer to manipulate gift cards.
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `__namedParameters` | `Object` |
|
||||
| `__namedParameters` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
BaseService.constructor
|
||||
TransactionBaseService<GiftCardService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:15](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L15)
|
||||
[services/gift-card.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L46)
|
||||
|
||||
## Properties
|
||||
|
||||
### configModule
|
||||
|
||||
• `Protected` `Optional` `Readonly` **configModule**: `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.configModule
|
||||
|
||||
___
|
||||
|
||||
### container
|
||||
|
||||
• `Protected` `Readonly` **container**: `unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.container
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
• `Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### giftCardRepository\_
|
||||
|
||||
• `Protected` `Readonly` **giftCardRepository\_**: typeof `GiftCardRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### giftCardTransactionRepo\_
|
||||
|
||||
• `Protected` `Readonly` **giftCardTransactionRepo\_**: typeof `GiftCardTransactionRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
• `Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
• `Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
• `Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
▪ `Static` **Events**: `Object`
|
||||
@@ -42,10 +130,49 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:11](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L11)
|
||||
[services/gift-card.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L42)
|
||||
|
||||
## Methods
|
||||
|
||||
### 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
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
▸ **create**(`giftCard`): `Promise`<`GiftCard`\>
|
||||
@@ -56,7 +183,7 @@ Creates a gift card with provided data given that the data is validated.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCard` | `GiftCard` | the gift card data to create |
|
||||
| `giftCard` | `CreateGiftCardInput` | the gift card data to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -66,33 +193,33 @@ the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:134](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L134)
|
||||
[services/gift-card.ts:155](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### createTransaction
|
||||
|
||||
▸ **createTransaction**(`data`): `Promise`<`any`\>
|
||||
▸ **createTransaction**(`data`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `data` | `any` |
|
||||
| `data` | `CreateGiftCardTransactionInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:120](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L120)
|
||||
[services/gift-card.ts:139](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L139)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
▸ **delete**(`giftCardId`): `Promise`<`any`\>
|
||||
▸ **delete**(`giftCardId`): `Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
Deletes a gift card idempotently
|
||||
|
||||
@@ -104,54 +231,59 @@ Deletes a gift card idempotently
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:288](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L288)
|
||||
|
||||
___
|
||||
|
||||
### generateCode\_
|
||||
|
||||
▸ **generateCode_**(): `string`
|
||||
|
||||
Generates a 16 character gift card code
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the generated gift card code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:62](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L62)
|
||||
[services/gift-card.ts:288](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L288)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`any`\>
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`GiftCard`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`GiftCard`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:78](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L78)
|
||||
[services/gift-card.ts:114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L114)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config?`): `Promise`<[`GiftCard`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
@@ -166,7 +298,7 @@ Gets a gift card by id.
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCardId` | `string` | id of gift card to retrieve |
|
||||
| `config` | `any` | optional values to include with gift card query |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | optional values to include with gift card query |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -176,34 +308,79 @@ the gift card
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:175](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L175)
|
||||
[services/gift-card.ts:220](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L220)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
▸ **retrieveByCode**(`code`, `config?`): `Promise`<`any`\>
|
||||
▸ **retrieveByCode**(`code`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `code` | `any` |
|
||||
| `config` | `Object` |
|
||||
| `code` | `string` |
|
||||
| `config` | `FindConfig`<`GiftCard`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:209](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L209)
|
||||
[services/gift-card.ts:229](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L229)
|
||||
|
||||
___
|
||||
|
||||
### retrieve\_
|
||||
|
||||
▸ `Protected` **retrieve_**(`selector`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`GiftCard`\> |
|
||||
| `config` | `FindConfig`<`GiftCard`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:185](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L185)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
▸ `Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `err` | `Record`<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
▸ **update**(`giftCardId`, `update`): `Promise`<`any`\>
|
||||
▸ **update**(`giftCardId`, `update`): `Promise`<`GiftCard`\>
|
||||
|
||||
Updates a giftCard.
|
||||
|
||||
@@ -212,34 +389,56 @@ Updates a giftCard.
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCardId` | `string` | giftCard id of giftCard to update |
|
||||
| `update` | `GiftCard` | the data to update the giftCard with |
|
||||
| `update` | `UpdateGiftCardInput` | the data to update the giftCard with |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:247](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L247)
|
||||
[services/gift-card.ts:244](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L244)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
▸ **withTransaction**(`transactionManager`): [`GiftCardService`](GiftCardService.md)
|
||||
▸ **withTransaction**(`transactionManager?`): [`GiftCardService`](GiftCardService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `transactionManager` | `any` |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`GiftCardService`](GiftCardService.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.js:40](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/gift-card.js#L40)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### generateCode
|
||||
|
||||
▸ `Static` **generateCode**(): `string`
|
||||
|
||||
Generates a 16 character gift card code
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the generated gift card code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L68)
|
||||
|
||||
Reference in New Issue
Block a user