mirror of
https://github.com/tribufu/tribufu-js
synced 2026-06-01 09:42:36 +00:00
Update api.ts
This commit is contained in:
parent
485d19b9f2
commit
4186350f7e
1 changed files with 8 additions and 8 deletions
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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue