From 83b7d78af185bec822a5ca2136319fce48055912 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 16 Mar 2024 11:44:32 -0400 Subject: [PATCH] feat: add account pins api --- src/client.ts | 10 +++------- src/methods/account.ts | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/methods/account.ts diff --git a/src/client.ts b/src/client.ts index 1c01cd7..1da42d6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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; diff --git a/src/methods/account.ts b/src/methods/account.ts new file mode 100644 index 0000000..2d37e36 --- /dev/null +++ b/src/methods/account.ts @@ -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 { + const opts = { + ...this.customOptions, + ...customOptions, + ...{ + endpointPath: "/s5/account/pins", + baseUrl: await this.portalUrl, + }, + }; + + const config = optionsToConfig(this, opts); + + return await getS5AccountPins(config); +}