0.18.3 • Published 4 months ago

lz-api-client v0.18.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

lz-api-client

Client SDK for LayerZ API

Description

lz-api-client is a client SDK for interacting with the LayerZ API. It provides a set of tools and functions to easily integrate LayerZ API into your applications.

Installation

You can install the package using npm:

npm install lz-api-client

Usage

Here's an example of how to use the lz-api-client:

Initialization

First, you need to initialize the client with the required parameters:

import { Client } from 'lz-api-client';

const client = new Client({
  apiURL: 'https://api.layerz.com',
  referrerPolicy: 'no-referrer'
});

Services

The client provides several services to interact with different parts of the API:

  • account
  • campaign
  • journey
  • layer
  • user

Example Usage

const campaigns = await client.campaign.get();
console.log(campaigns);

Making Requests

You can also make custom GET requests using the get method:

const response = await client.get('/path/to/resource', { param1: 'value1' });
console.log(response);

Handling errors

Every service method throws errors if something goes wrong. The errors that could be thrown are:

  • ClientError Means that something is wrong with the client request, for example invalid parameters. This error type encapsulate all HTTP errors from 400 to 499. The error includes these fields:

    • status (equal to fail)
    • message
    • data (object like, where keys are the invalid params and values the error message)
  • ServerError Means that something is wrong in the server, for example server is not available. This error type encapsulate all HTTP errors from 500. The error includes these fields:

    • status equal to error
    • message

License

This project is licensed under the MIT License. See the LICENSE file for details.

0.18.3

4 months ago

0.18.2

4 months ago

0.18.1

4 months ago

0.18.0

4 months ago

0.17.6

4 months ago

0.17.5

5 months ago

0.17.3

5 months ago

0.17.2

5 months ago

0.17.1

5 months ago

0.17.0

5 months ago

0.16.2

5 months ago

0.16.1

5 months ago

0.16.0

5 months ago

0.15.7

5 months ago

0.15.6

5 months ago

0.15.5

5 months ago

0.15.4

5 months ago

0.15.3

5 months ago

0.15.2

5 months ago

0.15.1

5 months ago

0.15.0

5 months ago

0.14.3

5 months ago

0.14.2

5 months ago

0.14.1

5 months ago

0.14.0

5 months ago

0.13.0

6 months ago

0.12.9

6 months ago

0.12.8

6 months ago

0.12.7

6 months ago

0.12.6

6 months ago

0.12.4

6 months ago

0.12.2

6 months ago

0.12.1

6 months ago

0.12.0

6 months ago

0.11.2

6 months ago

0.11.1

6 months ago

0.11.0

6 months ago

0.10.1

6 months ago

0.10.0

6 months ago

0.9.1

6 months ago

0.9.0

6 months ago

0.8.1

7 months ago

0.8.0

7 months ago

0.7.1

7 months ago

0.7.0

7 months ago

0.6.6

7 months ago

0.6.5

7 months ago

0.6.4

7 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.1

7 months ago

0.6.0

7 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.5.0

8 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.1

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago