New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

planetside-census-request

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

planetside-census-request

An API wrapper to request data from the Census API.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Planetside Census Request

An API wrapper to request data from the Census API.

Usage

Examples

CensusRequest with list validation

import CensusRequest from 'planetside-census-request';
import { NamespaceType } from 'planetside-census-data';

interface ICharacterFaction {
  character_id: string;
  faction_id: number;
}

const api = new CensusRequest(NamespaceType.PC, 's:example')

const getCharacters = async (
  ids: stirng[],
  collection: string = undefined
) => {
  return await api.get<ICharacterFaction[]>({
    uri: 'character',
    params: {
      'character_id': ids.join(','),
      'c:show': ['character_id','faction_id']
    },
    collection
  });
}

const characters = await getCharacters([
  '54200000000000000',
  '54200000000000001'
], 'character_list');

console.log(characters);

// [
//   {
//     character_id: '54200000000000000',
//     faction_id: 1,
//   },
//   {
//     character_id: '54200000000000001',
//     faction_id: 2,
//   }
// ]

CensusRequest without list validation

import CensusRequest from 'planetside-census-request';
import { NamespaceType } from 'planetside-census-data';

interface ICharacterFaction {
  character_id: string;
  faction_id: number;
}

const api = new CensusRequest(NamespaceType.PC, 's:example')

const getCharacters = async (
  ids: stirng[],
  collection: string = undefined
) => {
  return await api.get<ICharacterFaction[]>({
    uri: 'character',
    params: {
      'character_id': ids.join(','),
      'c:show': ['character_id','faction_id']
    },
    collection
  });
}

const characters = await getCharacters([
  '54200000000000000',
  '54200000000000001'
]);

console.log(characters);

// {
//    character_list: [
//      {
//        character_id: '54200000000000000',
//        faction_id: 1,
//      },
//      {
//        character_id: '54200000000000001',
//        faction_id: 2,
//      }
//    ],
//    returned: 2
// }

Keywords

planetside

FAQs

Package last updated on 12 Aug 2023

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