mirror of
https://github.com/tribufu/sdk-js
synced 2025-06-16 10:44:17 +00:00
Update api.ts
This commit is contained in:
16
src/api.ts
16
src/api.ts
@ -447,13 +447,13 @@ export class TribufuApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get packages from the Tribufu API.
|
* Get files from the Tribufu API.
|
||||||
* @param page
|
* @param page
|
||||||
* @returns Package[]
|
* @returns File[]
|
||||||
*/
|
*/
|
||||||
public async getPackages(page: number = 1): Promise<any[]> {
|
public async getFiles(page: number = 1): Promise<any[]> {
|
||||||
const headers = this.getHeaders();
|
const headers = this.getHeaders();
|
||||||
const responseBody = await this.http.get<any[]>(`/v1/packages?page=${page}`, headers);
|
const responseBody = await this.http.get<any[]>(`/v1/files?page=${page}`, headers);
|
||||||
|
|
||||||
if (!responseBody) {
|
if (!responseBody) {
|
||||||
return [];
|
return [];
|
||||||
@ -463,13 +463,13 @@ export class TribufuApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a package by id from the Tribufu API.
|
* Get a file by id from the Tribufu API.
|
||||||
* @param id
|
* @param id
|
||||||
* @returns Package | null
|
* @returns File | null
|
||||||
*/
|
*/
|
||||||
public async getPackageById(id: string): Promise<any> {
|
public async getFileById(id: string): Promise<any> {
|
||||||
const headers = this.getHeaders()
|
const headers = this.getHeaders()
|
||||||
const responseBody = await this.http.get<any>(`/v1/packages/${id}`, headers);
|
const responseBody = await this.http.get<any>(`/v1/files/${id}`, headers);
|
||||||
|
|
||||||
if (!responseBody) {
|
if (!responseBody) {
|
||||||
return null;
|
return null;
|
||||||
|
Reference in New Issue
Block a user