ReactionService

core.services.preprocessor.ReactionService
class ReactionService[F[_]](distributedCache: DistributedCacheService[F], client: Client[F], baseUri: Uri)(implicit evidence$1: Concurrent[F])

Service for managing reactions using both a distributed cache and remote HTTP service.

This service provides methods to fetch, create, and delete reactions. It integrates with a distributed cache for efficient data retrieval and interacts with a remote service via HTTP for data persistence and updates.

Type parameters

F

The effect type (e.g., IO, SyncIO, etc.) that supports concurrency.

Value parameters

baseUri

The base URI of the remote reaction service.

client

The HTTP client for making requests to the remote reaction service.

distributedCache

The distributed cache service used for storing and retrieving reactions.

Attributes

Source
ReactionService.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def createReaction(reaction: Reaction): F[Reaction]

Creates a new reaction.

Creates a new reaction.

This method sends a POST request to the remote reaction service to create a new reaction. The created reaction is then added to the distributed cache.

Value parameters

reaction

The reaction to create.

Attributes

Returns

An effectful computation that yields the created Reaction upon success.

Source
ReactionService.scala
def deleteReaction(id: ReactionId): F[Either[ReactionError, Boolean]]

Deletes a reaction by its ID.

Deletes a reaction by its ID.

This method sends a DELETE request to the remote reaction service. If the deletion is successful, the cache is updated to remove any stale data.

Value parameters

id

The unique identifier of the reaction to delete.

Attributes

Returns

An effectful computation that yields:

  • Right(true) if the reaction was successfully deleted.
  • Left(ReactionError) if an error occurred during deletion.
Source
ReactionService.scala

Fetches a reaction by its ID.

Fetches a reaction by its ID.

This method first checks the distributed cache for the requested reaction. If the reaction is not found in the cache, it fetches the data from the remote reaction service and updates the cache.

Value parameters

id

The unique identifier of the reaction to fetch.

Attributes

Returns

An effectful computation that yields the ReactionDetails for the given ID.

Source
ReactionService.scala