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

@diberry/github-magic

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@diberry/github-magic

GitHub GraphQL SDK with TS and Apollo

  • 2.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GraphQL Data Scrape SDK

Connect with personal access token (PAT)

const { whoami } = require("@diberry/github-magic");

const pat = "ghp_...";
const gitHubGraphQLUrl = "https://api.github.com/graphql";

async function main() {
  if (!pat) throw Error("auth is missing");
  if (!gitHubGraphQLUrl) throw Error("gitHubGraphQLUrl is missing");
  const rawResult = await whoami({ pat, gitHubGraphQlUrl: gitHubGraphQLUrl });
  return rawResult.viewer.login;
}
main().then((result)=>console.log(result)).catch(err=>console.log(err))

Connect with user token

  1. Must have already exchanged user's code for user's token
  2. Use token in place of PAT in client creation. Assumes token returned from GitHub is bearer token.
const { whoami } = require("@diberry/github-magic");

const token = "gho_...";
const gitHubGraphQLUrl = "https://api.github.com/graphql";

async function main() {
  if (!token) throw Error("auth is missing");
  if (!gitHubGraphQLUrl) throw Error("gitHubGraphQLUrl is missing");
  const rawResult = await whoami({ pat, gitHubGraphQlUrl: gitHubGraphQLUrl });
  return rawResult.viewer.login;
}
main().then((result)=>console.log(result)).catch(err=>console.log(err))

Keywords

FAQs

Package last updated on 27 Feb 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

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