Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trycourier/client-graphql

Package Overview
Dependencies
Maintainers
2
Versions
501
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trycourier/client-graphql

Courier GraqphQl Client for usage in the browser.

  • 1.13.2-internal.f0b559d.0
  • npm
  • Socket score

Version published
Weekly downloads
25K
increased by1.03%
Maintainers
2
Weekly downloads
 
Created
Source

Courier Client GraphQl

Courier GraqphQl Client for usage in the browser.

Initialization

You can initialize each module with either an object containing:

{
  clientKey: string;
  userId: string;
  userSignature?: string,
}

or you can create the client separtly and pass the client in:

import { createCourierClient } from "@trycourier/client-graphql";

const courierClient = createCourierClient({
  clientKey: "abc123",
  userId: "@me",
  userSignature: "SUPER_SECRET",
});

const messages = Messages({ client: courierClient })
const events = Events({ events: courierClient })
const events = Brands({ events: courierClient })

Messages

import { Messages } from "@trycourier/client-graphql";
const messagesApi = Messages({
  clientKey: "abc123",
  userId: "@me",
  userSignature: "SUPER_SECRET",
});

const getMessageCount = async (params?: {
  isRead?: boolean,
  from?: number,
  tags?: string[],
}) => {
  const messageCount = await messagesApi.getMessageCount(params);
  return messageCount;
};

const getMessages = async (
  params?: {
    isRead?: boolean,
    from?: number,
    tags?: string[],
  },
  after?: string
) => {
  const { startCursor, messages } = await messagesApi.getMessages(params);

  return {
    startCursor,
    messages,
  };
};

Events

import { Events } from "@trycourier/client-graphql";
const eventsApi = Events({
  clientKey: "abc123",
  userId: "@me",
  userSignature: "SUPER_SECRET",
});

const trackEvent = async (trackingId: string) => {
  await eventsApi.trackEvent(trackingId);
};

Brands

import { Brands } from "@trycourier/client-graphql";
const brandsApi = Brands({
  clientKey: "abc123",
  userId: "@me",
  userSignature: "SUPER_SECRET",
});

const getBrand = async (brandId?: string) => {
  const myBrand = await brandsApi.getBrand(brandId);
  return myBrand;
};

FAQs

Package last updated on 20 Apr 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