Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ship.paralect.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Services in our application are specific functionalities or data manipulations handled by objects, classes, or functions. You can add any service as needed for third-party API integrations or app metrics collection.

API Client

Description: The API Client, represented by the ApiClient class in packages/shared, wraps axios with better error handling and typed endpoint support. The typed client is auto-generated from API endpoints. Example Usage:
import { apiClient } from 'services/api-client.service';

// Using typed endpoints
const projects = await apiClient.projects.list.call({ page: 1, perPage: 10 });

// With useApiQuery hook
import { useApiQuery } from 'hooks';
const { data, isLoading } = useApiQuery(apiClient.projects.list);

Socket Service

Description: Socket Service provides functions for managing websocket connections, including connecting, disconnecting, and handling events. Example Usage:
import { socketService } from 'services';

// Listening for an event
socketService.on('user:updated', (data: User) => {
  queryClient.setQueryData(['account'], data);
});

// In React component
const onCardUpdated = () => {
  console.log('Card updated')
};

useEffect(() => {
  socketService.on('card:updated', onCardUpdated);

  return () => {
    socketService.off('card:updated', onCardUpdated);
  };
}, []);

Analytics Service

Description: Analytics Service offers a set of functionalities for working with third-party analytics systems like Mixpanel. It can be adapted to other platforms as needed. Example Usage:
import { analyticsService } from 'services';

// Tracking an event
analyticsService.track('New user created', { firstName, lastName });