Socket
Socket
Sign inDemoInstall

@mohammadsonu2004/github-users-api-wrapper

Package Overview
Dependencies
9
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @mohammadsonu2004/github-users-api-wrapper

A wrapper NPM package for public Github users api.


Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

github-users-api-wrapper

This NPM package functions as a wrapper to public Github users api.

Sample Usage

// Require/Import package
const githubUsersAPI = require("@mohammadsonu2004/github-users-api-wrapper");

/*
The package exposes two methods :
1. get_top_users
2. get_single_user
*/

// get_top_users() Usage
async function test1() {
  const response = await githubUsersAPI.get_top_users();
  // response is of type { data: SOME_VALUE | null, error: SOME_VALUE | null }
  // If call is successful:
  // data contains response and error is null
  // If call is unsuccessful:
  // data contains null and error contains error

  if (response.error) {
    // Some error occurred
    // Get exact error by reading response.error
  } else {
    // Successful response
    // Get response by reading response.data
  }
}

// get_single_user() Usage
async function test2() {
  // Pass userName as parameter to get_single_user function
  const response = await githubUsersAPI.get_single_user("mojombo");
  // response is of type { data: SOME_VALUE | null, error: SOME_VALUE | null }
  // If call is successful:
  // data contains response and error is null
  // If call is unsuccessful:
  // data contains null and error contains error

  if (response.error) {
    // Some error occurred
    // Get exact error by reading response.error
  } else {
    // Successful response
    // Get response by reading response.data
  }
}

Keywords

FAQs

Last updated on 07 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc