refactor: rename customOptions to clientOptions
This commit is contained in:
parent
5bc2915655
commit
1eb9ebbdf8
|
@ -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;
|
||||
|
|
|
@ -7,7 +7,7 @@ export async function accountPins(
|
|||
customOptions: CustomClientOptions = {},
|
||||
): Promise<AccountPinsResponse> {
|
||||
const opts = {
|
||||
...this.customOptions,
|
||||
...this.clientOptions,
|
||||
...customOptions,
|
||||
...{
|
||||
endpointPath: "/s5/account/pins",
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -58,7 +58,7 @@ export async function subscribeToEntry(
|
|||
) {
|
||||
const opts = {
|
||||
...DEFAULT_SUBSCRIBE_ENTRY_OPTIONS,
|
||||
...this.customOptions,
|
||||
...this.clientOptions,
|
||||
...customOptions,
|
||||
};
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ export async function uploadFile(
|
|||
): Promise<any> {
|
||||
const opts = {
|
||||
...DEFAULT_UPLOAD_OPTIONS,
|
||||
...this.customOptions,
|
||||
...this.clientOptions,
|
||||
...customOptions,
|
||||
} as CustomUploadOptions;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ export function optionsToConfig(
|
|||
|
||||
const finalOptions = {
|
||||
...def,
|
||||
...client.customOptions,
|
||||
...client.clientOptions,
|
||||
...extraOptions,
|
||||
} as CustomClientOptions;
|
||||
|
||||
|
|
Loading…
Reference in New Issue