npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@travel3/travel3-api

v0.1.1

Published

- [Travel3-Node-API](#travel3-node-api) - [Installation](#installation) - [Getting Started](#getting-started) - [Resources](#resources) - [Authentication](#authentication) - [Sign Up On Web](#sign-up-on-web) - [First Step](#first-s

Downloads

39

Readme

Travel3-Node-API

Installation

npm install --save @travel3/travel3-api

Getting Started

Travel3.Context.initialize({
    apiKey: 'YOUR_API_KEY',
    apiBaseUrl: 'https://travel-3-api.herokuapp.com',
    errorCallback: (error) => {
        // eslint-disable-next-line no-console, no-undef
        console.log('Error: ', error.data);
    }
});

Resources

Authentication

Sign Up On Web

First Step

Send the pre-register request to the server. This request will return a user id. You need to save this id for the next step.

import Travel3 from '@travel3/travel3-api';

await Travel3.Auth.preRegister({
    email: '[email protected]',
    client_id: process.env.CLIENT_ID,
    identifier_type: 'email'
});
  • Example Response
{
    "status": "ok",
    "data": {
        "user": {
            "id": "d5a84e54-9921-434b-9b1e-1c3b4a4754e7",
            "email": "[email protected]",
            "first_name": "",
            "last_name": "",
            "phone_number": null,
            "country_code": null,
            "created_at": "2022-10-04T14:20:07.819Z",
            "updated_at": "2022-10-04T14:20:07.819Z"
        }
    }
}
Second Step

Send the register request to the server. This request will return a access token. You need to save this access token for the next step.

import Travel3 from '@travel3/travel3-api';

await Travel3.Auth.register({
    user_id: 'd5a84e54-9921-434b-9b1e-1c3b4a4754e7',
    password: '12345678',
    password_confirmation: '12345678',
    nickname: 'roylee',
    client_id: process.env.CLIENT_ID
});
  • Example Response
{
    "status": "ok",
    "data": {
        "user": {
            "id": "d5a84e54-9921-434b-9b1e-1c3b4a4754e7",
            "email": "[email protected]",
            "nickname": "12345s6asd",
            "first_name": "",
            "last_name": ""
        },
        "access_token": {
            "access_token": "HNtA_G3VXfTlquk-ic9xio4904zQlqB2SuzLsxbgsd4",
            "token_type": "bearer",
            "expires_in": 172800,
            "refresh_token": "V1zu59f2aDzYNOcJOZg3noHHM-YuHRbsUd4HIE0M1Ug",
            "created_at": "2022-10-04T14:20:52.532Z"
        }
    }
}
    1. Third you need to send the wallet uuid generate request to the server. This request will return a client_secret, nonce and token. You need to save this uuid for the next step.
import Travel3 from '@travel3/travel3-api';

await Travel3.Wallet.generateUUID();

Login

import Travel3 from '@travel3/travel3-api';
import dotenv from 'dotenv';
dotenv.config();

await Travel3.Auth.login({
    email: '[email protected]',
    password: '12345678',
    grant_type: 'password',
    client_id: process.env.CLIENT_ID,
    client_secret: process.env.CLIENT_SECRET,
    identifier_type: 'email'
});

Event

List Going Events

import Travel3 from '@travel3/travel3-api';

const events = await Travel3.Event.listGoing({
    page: 0
});

Participate Event

import Travel3 from '@travel3/travel3-api';

await Travel3.Event.participate({
    event_id: '1'
});

List Featured Events

import Travel3 from '@travel3/travel3-api'

const events = await Travel3.Event.listFeatured()

Event Category

List Event Categories

import Travel3 from '@travel3/travel3-api';

const eventTypes = await Travel3.EventCategory.list();

Event Type

List Event Types

import Travel3 from '@travel3/travel3-api';

const eventTypes = await Travel3.EventType.list();

Account

Get Profile

import Travel3 from '@travel3/travel3-api';

const nfts = await Travel3.Account.getMe();

Update Profile

import Travel3 from '@travel3/travel3-api';

const nfts = await Travel3.Account.updateMe({
    first_name: 'Roy',
    last_name: 'Lee',
    nickname: 'roylee',
});

Update Password

import Travel3 from '@travel3/travel3-api';

const nfts = await Travel3.Account.updatePassword({
    old_password: '',
    password: '',
    password_confirmation: '',
});

Nft

List NFT

import Travel3 from '@travel3/travel3-api';

const nfts = await Travel3.Nft.list();

Nft Asset Item

Show NFT Asset Item

import Travel3 from '@travel3/travel3-api';

const nftAssetItem = await Travel3.NftAssetItem.show({
    nft_asset_item_id: '1'
});

Admin

Event

Get All Events
import Travel3 from '@travel3/travel3-api';

const events = await Travel3.Admin.Event.list();
Get Event By Id
import Travel3 from '@travel3/travel3-api';

const event = await Travel3.Admin.Event.show({
    event_id: 'cdf58f57-618c-41e3-9cd2-21d4c3691002'
});
Create Event

You have to retrieve event type id by using Travel3.EventType.list() before you create an event.

import Travel3 from '@travel3/travel3-api';

const event = await Travel3.Admin.Event.create({
    event_type_id: '7bbec334-db09-4d04-acea-09df4a7b0963',
    nft_collection_id: '2c196aa2-1939-4200-95ef-ffdae46d981d',
    name: '(Sample) MGM Cotai Starbucks Coffee Workshop',
    timezone: 'Asia/Hong_Kong',
    slug: 'mgm-cotai-starbucks-coffee-workshop',
    started_at: '2022-08-01 04:44:17',
    scheduled_to_end_at: '2022-09-30 04:44:17',
    description: 'Hello world',
    language: 'Chinese',
    venue_attributes: {
        name: 'MGM Cotai',
        address: '4HW9+78V, Av. da Nave Desportiva, Macao',
        latitude: 22.145734,
        longitude: 113.568012,
        city: 'Macau SAR',
        state: 'Macau SAR',
        country: 'Macau SAR'
    },
    images_attributes: [
        {
            src: 'https://cdn.pixabay.com/photo/2016/03/26/23/23/starbucks-1281880__480.jpg'
        }
    ]
});

Direct Upload Image

  1. Get the image metadata from travel3 api
const metadata = await Travel3.Image.getMedia({
    filename: '123.png',
    type: 'image/png',
    access_token
});
  1. Upload the image to the url
await Travel3.directS3Upload(file, metadata.fields);

Delete Image

import Travel3 from '@travel3/travel3-api';

await Travel3.Image.delete({
    media_id: "aaaa-bbbb-cccc-dddd"
});

Nft

List NFT

import Travel3 from '@travel3/travel3-api';

const nfts = await Travel3.Nft.list();

Balance

Get Balance

import Travel3 from '@travel3/travel3-api';

const balance = await Travel3.Balance.show();

Daily Check-in

1. Get Mystery List

import Travel3 from '@travel3/travel3-api';

const mysteries = await Travel3.MyStery.list();

2. Attend

import Travel3 from '@travel3/travel3-api';

const attend = await Travel3.Attend.create({
    loyalty_reward_id: '3a0e038b-eb07-43df-8bfb-7c9e86bb9515'
});

Product

1. List Product

import Travel3 from '@travel3/travel3-api';

const productList = await Travel3.Product.list();

2. Show Product

import Travel3 from '@travel3/travel3-api';

const product = await Travel3.Product.show({
    productId: 7987297517852
});

Organization

Event

Get All Events
import Travel3 from '@travel3/travel3-api';

const events = await Travel3.Organization.Event.list();
Get Event By Id
import Travel3 from '@travel3/travel3-api';

const event = await Travel3.Organization.Event.show({
    event_id: 'cdf58f57-618c-41e3-9cd2-21d4c3691002'
});
Create Event

You have to retrieve event type id by using Travel3.EventType.list() before you create an event.

import Travel3 from '@travel3/travel3-api';

const event = await Travel3.Organization.Event.create({
    event_type_id: '7bbec334-db09-4d04-acea-09df4a7b0963',
    event_category_id: '7bbec334-db09-4d04-acea-09df4a7b0963',
    nft_collection_id: '2c196aa2-1939-4200-95ef-ffdae46d981d',
    name: '(Sample) MGM Cotai Starbucks Coffee Workshop',
    timezone: 'Asia/Hong_Kong',
    slug: 'mgm-cotai-starbucks-coffee-workshop',
    started_at: '2022-08-01 04:44:17',
    scheduled_to_end_at: '2022-09-30 04:44:17',
    description: 'Hello world',
    language: 'Chinese',
    venue_attributes: {
        name: 'MGM Cotai',
        address: '4HW9+78V, Av. da Nave Desportiva, Macao',
        latitude: 22.145734,
        longitude: 113.568012,
        city: 'Macau SAR',
        state: 'Macau SAR',
        country: 'Macau SAR'
    },
    images_attributes: [
        {
            src: 'https://cdn.pixabay.com/photo/2016/03/26/23/23/starbucks-1281880__480.jpg'
        }
    ]
});
Update Event By Event ID
import Travel3 from '@travel3/travel3-api';

Travel3.Organization.Event.update({
    event_id: 'cdf58f57-618c-41e3-9cd2-21d4c3691002',
    event_type_id: '7bbec334-db09-4d04-acea-09df4a7b0963',
    nft_collection_id: '2c196aa2-1939-4200-95ef-ffdae46d981d',
    name: '(Sample) MGM Cotai Starbucks Coffee Workshop',
    timezone: 'Asia/Hong_Kong',
    slug: 'mgm-cotai-starbucks-coffee-workshop',
    started_at: '2022-08-01 04:44:17',
    scheduled_to_end_at: '2022-09-30 04:44:17',
    description: 'Hello world',
    language: 'Chinese',
    venue_attributes: {
        name: 'MGM Cotai',
        address: '4HW9+78V, Av. da Nave Desportiva, Macao',
        latitude: 22.145734,
        longitude: 113.568012,
        city: 'Macau SAR',
        state: 'Macau SAR',
        country: 'Macau SAR'
    },
    images_attributes: [
        {
            src: 'https://cdn.pixabay.com/photo/2016/03/26/23/23/starbucks-1281880__480.jpg'
        }
    ]
});
List Participants By Event ID
import Travel3 from '@travel3/travel3-api';

const participants = await Travel3.Organization.Event.listParticipants({
    event_id: 'cdf58f57-618c-41e3-9cd2-21d4c3691002'
});