feat: add account pins api

This commit is contained in:
Derrick Hammer 2024-03-16 11:44:32 -04:00
parent 7cdcfe3b3e
commit 83b7d78af1
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 24 additions and 7 deletions

View File

@ -1,10 +1,3 @@
import axios, {
AxiosError,
AxiosProgressEvent,
AxiosRequestConfig,
} from "axios";
import type { AxiosResponse, ResponseType, Method } from "axios";
import {
uploadFile,
uploadLargeFile,
@ -36,6 +29,8 @@ import {
import { CustomClientOptions } from "#utils/options.js";
import { throwValidationError } from "#utils/validation.js";
import { accountPins } from "./methods/account.js";
/**
* The S5 Client which can be used to access S5-net.
*/
@ -56,6 +51,7 @@ export class S5Client {
publishEntry = publishEntry;
createEntry = createEntry;
getEntry = getEntry;
accountPins = accountPins;
// Download
protected uploadSmallFile = uploadSmallFile;
protected uploadSmallFileRequest = uploadSmallFileRequest;

21
src/methods/account.ts Normal file
View File

@ -0,0 +1,21 @@
import { CustomClientOptions, optionsToConfig } from "#utils/options.js";
import { S5Client } from "#client.js";
import { AccountPinsResponse, getS5AccountPins } from "#generated/index.js";
export async function accountPins(
this: S5Client,
customOptions: CustomClientOptions = {},
): Promise<AccountPinsResponse> {
const opts = {
...this.customOptions,
...customOptions,
...{
endpointPath: "/s5/account/pins",
baseUrl: await this.portalUrl,
},
};
const config = optionsToConfig(this, opts);
return await getS5AccountPins(config);
}