Socket
Socket
Sign inDemoInstall

@octokit/webhooks-types

Package Overview
Dependencies
0
Maintainers
4
Versions
109
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @octokit/webhooks-types

Generated TypeScript definitions based on community contributed JSON Schemas


Version published
Weekly downloads
707K
increased by2.19%
Maintainers
4
Install size
217 kB
Created
Weekly downloads
 

Readme

Source

Octokit Webhooks

machine-readable, always up-to-date GitHub Webhooks specifications

Update status

Download

Download the latest specification at octokit.github.io/webhooks/payload-examples/api.github.com/index.json

Usage

This package ships with types for the webhook events generated from the respective json schemas, which you can use like so:

import { WebhookEvent, IssuesOpenedEvent } from "@octokit/webhooks-types";

const handleWebhookEvent = (event: WebhookEvent) => {
  if ("action" in event && event.action === "completed") {
    console.log(`${event.sender.login} completed something!`);
  }
};

const handleIssuesOpenedEvent = (event: IssuesOpenedEvent) => {
  console.log(
    `${event.sender.login} opened "${event.issue.title}" on ${event.repository.full_name}`,
  );
};

⚠️ Caution ⚠️: Webhooks Types are expected to be used with the strictNullChecks option enabled in your tsconfig. If you don't have this option enabled, there's the possibility that you get never as the inferred type in some use cases. See #395 for details.

See also

LICENSE

MIT

FAQs

Last updated on 22 Apr 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