refactor: rename customOptions to clientOptions

This commit is contained in:
Derrick Hammer 2024-03-18 09:14:34 -04:00
parent 5bc2915655
commit 1eb9ebbdf8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
6 changed files with 13 additions and 9 deletions

View File

@ -74,10 +74,14 @@ export class S5Client {
throwValidationError("portalUrl", portalUrl, "parameter", "string");
}
this._portalUrl = ensureUrl(portalUrl);
this._customOptions = customOptions;
this._clientOptions = customOptions;
}
private _customOptions: CustomClientOptions;
private _clientOptions: CustomClientOptions;
get clientOptions(): CustomClientOptions {
return this._clientOptions;
}
get customOptions(): CustomClientOptions {
return this._customOptions;

View File

@ -7,7 +7,7 @@ export async function accountPins(
customOptions: CustomClientOptions = {},
): Promise<AccountPinsResponse> {
const opts = {
...this.customOptions,
...this.clientOptions,
...customOptions,
...{
endpointPath: "/s5/account/pins",

View File

@ -52,7 +52,7 @@ const DEFAULT_GET_METADATA_OPTIONS = {};
* Initiates a download of the content of the cid within the browser.
*
* @param this - S5Client
* @param cid - 46-character cid, or a valid cid URL. Can be followed by a path. Note that the cid will not be encoded, so if your path might contain special characters, consider using `customOptions.path`.
* @param cid - 46-character cid, or a valid cid URL. Can be followed by a path. Note that the cid will not be encoded, so if your path might contain special characters, consider using `clientOptions.path`.
* @param [customOptions] - Additional settings that can optionally be set.
* @param [customOptions.endpointDownload="/"] - The relative URL path of the portal endpoint to contact.
* @returns - The full URL that was used.
@ -86,7 +86,7 @@ export async function getCidUrl(
cid: string,
customOptions: CustomDownloadOptions = {},
): Promise<string> {
const opt = { ...this.customOptions, customOptions };
const opt = { ...this.clientOptions, customOptions };
return addUrlQuery(path.join(this.portalUrl, cid), {
auth_token: opt.apiKey,
});
@ -132,7 +132,7 @@ export async function downloadData(
): Promise<ArrayBuffer> {
const opts = {
...DEFAULT_DOWNLOAD_OPTIONS,
...this.customOptions,
...this.clientOptions,
...customOptions,
download: true,
};

View File

@ -58,7 +58,7 @@ export async function subscribeToEntry(
) {
const opts = {
...DEFAULT_SUBSCRIBE_ENTRY_OPTIONS,
...this.customOptions,
...this.clientOptions,
...customOptions,
};

View File

@ -90,7 +90,7 @@ export async function uploadFile(
): Promise<any> {
const opts = {
...DEFAULT_UPLOAD_OPTIONS,
...this.customOptions,
...this.clientOptions,
...customOptions,
} as CustomUploadOptions;

View File

@ -37,7 +37,7 @@ export function optionsToConfig(
const finalOptions = {
...def,
...client.customOptions,
...client.clientOptions,
...extraOptions,
} as CustomClientOptions;