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

@natade-coco/pocket-sdk

v0.15.0

Published

Library for accessing data of natadeCOCO mobile app from natadeCOCO content app.

Downloads

16

Readme

Pocket SDK

Library for accessing data of natadeCOCO mobile app (Pocket) from natadeCOCO content app (App).

Pocket SDK

Installation

npm install @natade-coco/pocket-sdk

Version Compatibility

| Pocket SDK | Pocket | | :-- | :-- | | 0.15.0+ | 1.19.4+ |

Usage

import Pocket from '@natade-coco/pocket-sdk';

Pocket.getProfile(['name', 'email'])
  .then(profile => {
    if (profile) {
      const { name, email } = profile;
      console.log(name);  // ex.) 名無しユーザー
      console.log(email);  // ex.) [email protected]
    }
  })
  .catch(error => {
    console.error(error);  // ex.) userCanceled
  });

Error

| error | description | | :-- | :-- | | badRequest | The API argument is incorrect. | | unavailable | The API is in unavailable state. | | permissionDenied | User has denied access. | | userCanceled | The operation was interrupted because user canceled it. | | incompatible | Client app is not running on Pocket (react-native-webview). | | internalError | Error has occurred inside SDK. Usually does not occur. |

API

getProfile(params: string[]): Promise<Profile | undefined>

Get user's profile.

| param | type | description | example | | :-- | :-- | :-- | :-- | | params | string[] | Specify parameter names you want to get in user's profile. | ['name', 'email'] |

Profile object

Only include those contained in params.

| param | type | example | | :-- | :-- | :-- | | name? | string | '名無しユーザー' | | fullName? | string | undefined | 'ナタデココ 太郎' | | email? | string | undefined | '[email protected]' | | tel? | string | undefined | '012-345-6789' | | image? | string | undefined | 'https://natade-coco.com/example.jpg' |

getEthereumAddress(): Promise<string>

Gets user's Ethereum address like 0x1a2b..... The address is derived from the user's HD wallet (BIP44) with path m/44'/60'/0'/0/0.

requestSignJWT(serviceType?: string): Promise<string>

Get JWT signed by Pocket user for the service. The JWT exp is set to 24 hours.

| param | type | description | | :-- | :-- | :-- | | serviceType | 'AppHubService' | 'PaymentHubService' | Service type as audience of JWT (default: 'AppHubService') |

makeConnection(target: string, path: string, allows: string[]): Promise<string>

Generate a new DID document associated with the app, and return its URL.

| param | type | description | example | | :-- | :-- | :-- | :-- | | target | string | DID of the app | 'did:ethr:0x1234...' | | path | string | Path of the app | '/orders/1' | | allows | string[] | DID of users allowed to use target app | ['did:ethr:0x5678....'] |

openInBrowser(url: string): Promise<void>

Open the URL in an external web browser.

| param | type | description | example | | :-- | :-- | :-- | :-- | | url | string | URL to open in browser | 'https://natade-coco.com/' |

share(content: ShareContent): Promise<void>

Share a text or file.

ShareContent

| param | type | description | example | | :-- | :-- | :-- | :-- | | text? | string | Text to share | 'Lorem Ipsum' | | file? | File | File object to share | 'https://natade-coco.com/example.png' |

File

| param | type | description | example | | :-- | :-- | :-- | :-- | | url | string | File URL | 'https://natade-coco.com/example.png' 'data:image/png;base64,xxxxx' | | name? | string | File name | 'example.png' | | type? | string | File MIME Type | 'image/png' |

lockOrientation(orientation: string | null): Promise<void>

Locks the orientation of the device while the content is displayed.

| param | type | description | | :-- | :-- | :-- | | orientation | 'portrait' | 'landscape' | 'landscapeLeft' | 'landscapeRight' | null | Orientation to lock (null: unlock any orientation) |