### File

`packages/core/src/lib/services/queue/api-queue.service.mock.ts`

### Extends

`ApiQueueService`

### Index

###### Methods

- addQueueItem
- getQueue
- getQueueItem
- processAllQueueItems
- processQueueItem
- removeAllQueueItem
- removeQueueItem
- processAllQueueItemsSequential

### Constructor

`constructor()`

### Methods

addQueueItem
`addQueueItem()`
Returns : `void`

getQueue
`getQueue()`
Returns : `Observable<ApiQueueItem[]>`

getQueueItem
`getQueueItem(id: string)`

Parameters :

Name | Type | Optional
id | `string` | No

Returns : `Observable<ApiQueueItem>`

processAllQueueItems
`processAllQueueItems()`

Type parameters :

- T

Returns : `Observable<T>`

processQueueItem
`processQueueItem()`

Type parameters :

- T

Returns : `Observable<T>`

removeAllQueueItem
`removeAllQueueItem()`
Returns : `void`

removeQueueItem
`removeQueueItem()`
Returns : `void`

processAllQueueItemsSequential
`processAllQueueItemsSequential(ascending: unknown)`

Type parameters :

- T

Processes all items in the queue sequentially, based on their timestamp ordering.

This method first orders the items in the API queue by their timestamp, either in ascending or descending order as specified by the `ascending` parameter. It then processes each item using `buildHttpRequest`, ensuring that each request is completed before the next begins. This sequential processing is crucial when the order of execution matters for HTTP requests in the queue. The method returns an Observable that emits the responses following the same order as the queue items were processed.

The function currently returns `Observable<any>`, indicating a broad type. Future improvements should focus on specifying a more accurate return type or utilizing generics for increased type safety.

Example :

                                    timestamp. Defaults to `true`.

Example :

    this.processAllQueueItemsSequential().subscribe(response => {
      // Handle each response in the order of queue processing
    });

Parameters :

Name | Type | Optional | Default value | Description

ascending

`unknown`

No

`true`

- Determines whether the queue items are processed in ascending order of their timestamp. Defaults to `true`.

Returns : `Observable<T>`

An Observable emitting the responses of the HTTP requests in the order they were processed.

# results matching ""

# No results matching ""