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

@bearer/functions

Package Overview
Dependencies
Maintainers
4
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bearer/functions

Bearer Functions

  • 0.100.1-next.48
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
decreased by-90.59%
Maintainers
4
Weekly downloads
 
Created
Source

@bearer/functions

Usage

Creating a FetchData function

import { FetchData, TOAUTH2AuthContext } from '@bearer/functions'
import Client from './client'

export default class ListPullRequestsFunction {
  static functionName: string = 'listPullRequests'
  static functionType: any = FetchData

  static async action({ context, params }: { context: TOAUTH2AuthContext; params: any }) {
    try {
      const { data } = await Client(context.authAccess.accessToken).get(`/repos/${params.fullName}/pulls`, {
        params: { per_page: 10, ...params }
      })
      return { data }
    } catch (error) {
      return { error: error.toString() }
    }
  }
}

Creating a SaveData function

import { SaveState, TOAUTH2AuthContext } from '@bearer/functions'
import Client from './client'

export type TState = {
  pullRequests: any
}

export type TParams = {
  fullName: string,
  page?: number
}

export default class ListPullRequestsFunction {
  static functionName: string = 'listPullRequests'
  static functionType: any = SaveState

  static async action({ context, params, state }: { context: TOAUTH2AuthContext; params: TParams, state: TState }) {
    try {
      const { data } = await Client(context.authAccess.accessToken).get(`/repos/${params.fullName}/pulls`, {
        params: { per_page: 10, ...params }
      })
      return { data, state: { pullRequests: data } }
    } catch (error) {
      return { error: error.toString() }
    }
  }
}

FAQs

Package last updated on 07 Mar 2019

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