New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@flashcoffee/fctalonone

Package Overview
Dependencies
Maintainers
11
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flashcoffee/fctalonone

Flash Coffee Talon.One SDK

  • 1.2.50
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
11
Weekly downloads
 
Created
Source

fcbraze

Installation

$ yarn add @flashcoffee/fctalonone

Setup

Set required environment variable for credentials

TALON_ONE_URL=https://your-org.asia-southeast1.talon.one
TALON_ONE_API_KEY=ApiKey-v1 yourapikey
TALON_ONE_TOKEN=Bearer yourtoken
TALON_ONE_APP_ID=123

Usage

import FCTalonOne from '@flashcoffee/fctalonone';

await FCTalonOne.integrationApi.updateCustomerSessionV2();
await FCTalonOne.managementApi.getLoyaltyPoints();

OR

import {TalonOneIntegrationApi} from '@flashcoffee/fctalonone';

@Injectable()
export class SomeService {
  constructor(
    private readonly talonOneIntegration: TalonOneIntegrationApi,
    private readonly talonOneManagement: TalonOneManagementApi,
  ) {}

  public async someMethod() {
    await this.talonOneIntegration.updateCustomerSessionV2();
    await this.talonOneManagement.getLoyaltyPoints();
  }
}

@Module({
  providers: [SomeService, TalonOneIntegrationApi],
})
export class SomeModule {}

Available APIs (integration)

All: Github

talonOneIntegration.api; // Available APIs: https://github.com/talon-one/talon_one.js/blob/master/docs/IntegrationApi.md#talononeintegrationapi
talonOneIntegration.updateCustomerSessionV2();
talonOneIntegration.updateCustomerProfileV2();

Available APIs (Management)

All: Github

talonOneManagement.api; // Available APIs: https://github.com/talon-one/talon_one.js/blob/master/docs/ManagementApi.md#talononemanagementapi
talonOneManagement.getApplications();
talonOneManagement.getCampaign();
talonOneManagement.getCampaigns();
talonOneManagement.getCampaignByAttributes();
talonOneManagement.getApplicationCustomer();
talonOneManagement.getApplicationCustomers();
talonOneManagement.getCustomersByAttributes();
talonOneManagement.getLoyaltyPoints();
talonOneManagement.addLoyaltyPoints();
talonOneManagement.removeLoyaltyPoints();
talonOneManagement.searchCouponsAdvancedApplicationWideWithoutTotalCount();
talonOneManagement.createCoupons();
talonOneManagement.updateCoupon();
talonOneManagement.deleteCoupons();

Error Handle

Can refer to this interfaces:

import {
  ITalonOneError,
  IErrorResponse,
  IErrorResponseWithStatus,
  IAPIError,
  IErrorSource,
} from '@flashcoffee/fctalonone';
import {ITalonOneError} from '@flashcoffee/fctalonone';

try {
  const loyaltyPoints = await FCTalonOne.managementApi.getLoyaltyPoints();
} catch (error) {
  if ((error as ITalonOneError).response?.ok === false) {
    const err = error as ITalonOneError;

    console.error('Error', {
      status: err.status,
      statusText: err.statusText,
      body: {
        message: err.body.message,
        errors: err.body.errors,
        StatusCode: err.body.StatusCode,
      },
      response: err.response,
    });

    throw error;
  }
}

Keywords

FAQs

Package last updated on 19 Jul 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc