Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@gokarla-io/client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gokarla-io/client

Karla API Client

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Karla TypeScript client

This TypeScript client library provides a comprehensive and easy-to-use interface to Karla's APIs and other services. Designed to help developers integrate and interact with Karla efficiently, this client supports all major service features including merchant, campaign, voucher, order and shipment management, data retrieval, and real-time updates.

See our API Overview for more details.

Features

  • Authentication: Handle API authentication seamlessly.
  • Data Retrieval: Fetch data using simple asynchronous methods.
  • Webhooks: Set up and manage webhooks.
  • Error Handling: Robust error handling tailored for clarity and quick debugging.
  • Type Safety: Full TypeScript support ensures type safety across all interactions.

Installation

Install the package:

npm install @gokarla-io/client
# or
yarn add @gokarla-io/client
# or
pnpm add @gokarla-io/client

Usage

Here's a quick example to get you started with the Karla TypeScript client.

This example demonstrates how to authenticate and fetch merchant data:

Importing and Initializing the Client

import { Karla } from "@gokarla-io/client";
import type { KarlaREST } from "@gokarla-io/client";

const { rest: apiClient } = Karla({
  auth: {
    username: process.env.KARLA_API_USERNAME,
    apiKey: process.env.KARLA_API_TOKEN,
  },
});

The REST interface is exposed under the rest attribute. More interfaces will be available in the future.

Fetching data

const { data } = await apiClient.GET("/v1/shops", {
  params: { query: { page: 1, per_page: 100 } },
});

Configuration Options

This client library offers various configuration options to tailor the API client to your needs:

  • baseUrl: Override the default API endpoint for testing or development purposes.
  • headers: Customize headers sent with each request.

Example of setting configuration options:

const karla = Karla({
  baseUrl: process.env.KARLA_API_URL,
  headers: {
    "Custom-Header": "value",
  },
});

FAQs

Package last updated on 05 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts