Skip to content

Commit

Permalink
use rest
Browse files Browse the repository at this point in the history
  • Loading branch information
trumant committed Mar 30, 2024
1 parent 2b3fa0c commit 5bde719
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 4 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ class GitHubClient {
*/
async getPackage(file, baseBranch) {
try {
const { data: fileInfo } = await this.octokit.repos.getContents({
const { data: fileInfo } = await this.octokit.rest.repos.getContents({
owner: this.owner,
path: file,
ref: baseBranch,
Expand Down Expand Up @@ -512,7 +512,7 @@ class GitHubClient {
*/
async fetchMessage() {
if (this.messageId === undefined) {
const { data } = await this.octokit.issues.listComments({
const { data } = await this.octokit.rest.issues.listComments({
owner: this.owner,
repo: this.repo,
issue_number: this.prNumber
Expand All @@ -526,7 +526,7 @@ class GitHubClient {
* List files in the current pull request
*/
async listFiles() {
const { data } = await this.octokit.pulls.listFiles({
const { data } = await this.octokit.rest.pulls.listFiles({
owner: this.owner,
repo: this.repo,
pull_number: this.prNumber
Expand Down Expand Up @@ -558,7 +558,7 @@ class GitHubClient {
async updateMessage(content) {
if (!this.messageId)
return this.createMessage(content);
await this.octokit.issues.updateComment({
await this.octokit.rest.issues.updateComment({
owner: this.owner,
repo: this.repo,
comment_id: this.messageId,
Expand All @@ -571,7 +571,6 @@ class GitHubClient {
static getClient() {
if (!this.hydratedInstance)
this.hydratedInstance = new GitHubClient();
console.log(this.hydratedInstance);
return this.hydratedInstance;
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/services/github-sdk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GitHubClient {
*/
public async getPackage(file: string, baseBranch: string): Promise<Package> {
try {
const {data: fileInfo} = await this.octokit.repos.getContents({
const {data: fileInfo} = await this.octokit.rest.repos.getContents({
owner: this.owner,
path: file,
ref: baseBranch,
Expand Down Expand Up @@ -118,7 +118,7 @@ class GitHubClient {
*/
public async fetchMessage(): Promise<number | undefined> {
if (this.messageId === undefined) {
const {data} = await this.octokit.issues.listComments({
const {data} = await this.octokit.rest.issues.listComments({
owner: this.owner,
repo: this.repo,
issue_number: this.prNumber
Expand All @@ -138,7 +138,7 @@ class GitHubClient {
* List files in the current pull request
*/
public async listFiles(): Promise<string[]> {
const {data} = await this.octokit.pulls.listFiles({
const {data} = await this.octokit.rest.pulls.listFiles({
owner: this.owner,
repo: this.repo,
pull_number: this.prNumber
Expand Down Expand Up @@ -173,7 +173,7 @@ class GitHubClient {
public async updateMessage(content: string): Promise<void> {
if (!this.messageId) return this.createMessage(content)

await this.octokit.issues.updateComment({
await this.octokit.rest.issues.updateComment({
owner: this.owner,
repo: this.repo,
comment_id: this.messageId,
Expand All @@ -186,8 +186,7 @@ class GitHubClient {
*/
public static getClient(): GitHubClient {
if (!this.hydratedInstance) this.hydratedInstance = new GitHubClient()
console.log(this.hydratedInstance);


return this.hydratedInstance
}
}
Expand Down

0 comments on commit 5bde719

Please sign in to comment.