ToolJet/marketplace/plugins/github/lib/query_operations.ts
Arpit 636c4a62c5
[chore] Eslint fixes (#5988)
* lint fixes: frontend

* lint fixes: marketplace

* lint fixes: plugins-client js files

* typo fix

* eslint updates/fixes for marketplace

* eslint updates/fixes for plugins

* removing "@typescript-eslint/no-floating-promises for plugins"

* ignore client.js and server.js

* ignore client.js and server.js

* ignore client.js and server.tss

* Delete client.js

* ignore cypress-test/**
2023-04-11 15:34:58 +05:30

35 lines
1.1 KiB
TypeScript

import { Octokit } from 'octokit';
import { QueryOptions } from './types';
export async function getUserInfo(octokit: Octokit, options: QueryOptions): Promise<object> {
const { data } = await octokit.request('GET /users/{username}', {
username: options.username,
});
return data;
}
export async function getRepo(octokit: Octokit, options: QueryOptions): Promise<object> {
const { data } = await octokit.request('GET /repos/{owner}/{repo}', {
owner: options.owner,
repo: options.repo,
});
return data;
}
export async function getRepoIssues(octokit: Octokit, options: QueryOptions): Promise<object> {
const { data } = await octokit.request('GET /repos/{owner}/{repo}/issues', {
owner: options.owner,
repo: options.repo,
state: options.state || 'all',
});
return data;
}
export async function getRepoPullRequests(octokit: Octokit, options: QueryOptions): Promise<object> {
const { data } = await octokit.request('GET /repos/{owner}/{repo}/pulls', {
owner: options.owner,
repo: options.repo,
state: options.state || 'all',
});
return data;
}