0.3.1 • Published 5 months ago

@getspot/spot-sdk v0.3.1

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

Spotsdk TypeScript SDK 0.3.1

Welcome to the Spotsdk SDK documentation. This guide will help you get started with integrating and using the Spotsdk SDK in your project.

This SDK was generated by liblab

Versions

  • API version: 1.0.0
  • SDK version: 0.3.1

About the API

Spot Platform API

Table of Contents

Setup & Configuration

Supported Language Versions

This SDK is compatible with the following versions: TypeScript >= 4.8.4

Installation

To get started with the SDK, we recommend installing using npm:

npm install @getspot/spot-sdk

Authentication

OAuth Authentication

The Spotsdk API uses OAuth for authentication.

You need to provide the OAuth parameters when initializing the SDK.

const sdk = new Spotsdk({ clientId: 'CLIENT_ID', clientSecret: 'CLIENT_SECRET' });

If you need to set or update the OAuth parameters after the SDK initialization, you can use:

const sdk = new Spotsdk();
sdk.clientId = 'CLIENT_ID';
sdk.clientSecret = 'CLIENT_SECRET';

Environments

The SDK supports different environments for various stages of development and deployment.

Here are the available environments:

DEFAULT = 'https://api.getspot.com';
PRODUCTION = 'https://api.getspot.com';
SANDBOX = 'https://api.sandbox.getspot.com';

Setting an Environment

To configure the SDK to use a specific environment, you can set the base URL as follows:

const sdk = new Spotsdk();
sdk.setEnvironment(Environment.DEFAULT);

Setting a Custom Timeout

You can set a custom timeout for the SDK's HTTP requests as follows:

const spotsdk = new Spotsdk({ timeout: 10000 });

Sample Usage

Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:

import { Spotsdk } from '@getspot/spot-sdk';

(async () => {
  const spotsdk = new Spotsdk({
    clientId: 'CLIENT_ID',
    clientSecret: 'CLIENT_SECRET',
    spotPartnerId: 'SPOT_PARTNER_ID',
  });

  const { data } = await spotsdk.enrollments.fetchWebhookConfiguration({
    xSpotPartnerId: 'X-Spot-Partner-Id',
  });

  console.log(data);
})();

Services

The SDK provides various services to interact with the API.

Name
AuthService
QuoteService
EnrollmentsService

Models

The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.

NameDescription
OAuthTokenRequestDto
OAuthTokenResponseDto
OAuthErrorResponseDto
QuoteRequestDto
QuoteMetadataDto
QuoteResponseDto
QuoteDataDto
QuoteCommunicationDto
QuoteDeclineResponseDto
RequoteAcceptRequestDto
RequoteAcceptResponseDto
QuoteAcceptRequestDto
QuotePurchaserDto
QuotePolicyAddressDto
QuoteAcceptResponseDto
RequoteRequestDto
RequoteResponseDto
RequoteDataDto
PartnerWebhookConfigurationDto
RegisterPartnerWebhookConfigurationDto
CfarEnrollmentResolveDto
EnrollmentResultDto

License

This SDK is licensed under the MIT License.

See the LICENSE file for more details.

0.3.1

5 months ago

0.2.2

5 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.1.1

6 months ago

1.0.0

7 months ago