UNPKG

@sociate/sociate-api-sdk

Version:

Javascript client for Sociate AI APIs

51 lines (50 loc) 1.37 kB
import { TrendsAPI } from './modules/trends'; import { HttpClient } from './lib/core/http'; import { AuthAPI } from './modules/auth'; import { ProductsAPI } from './modules/products'; import { SearchAPI } from './modules/search'; import { UsersAPI } from './modules/users'; export class SociateClient { httpClient; authAPI; productsAPI; searchAPI; usersAPI; trendsAPI; constructor(config) { this.httpClient = new HttpClient(config.basePath, config.token); this.authAPI = new AuthAPI(this.httpClient); this.productsAPI = new ProductsAPI(this.httpClient); this.searchAPI = new SearchAPI(this.httpClient); this.usersAPI = new UsersAPI(this.httpClient); this.trendsAPI = new TrendsAPI(this.httpClient); } get auth() { return this.authAPI; } get products() { return this.productsAPI; } get search() { return this.searchAPI; } get trends() { return this.trendsAPI; } get users() { return this.usersAPI; } /** * Sets the authentication token for the client. * @param token - The authentication token. */ setToken(token) { this.httpClient.setToken(token); } /** * Clears the authentication token. */ clearToken() { this.httpClient.clearToken(); } }