Skip to content

client API methods general

Steve edited this page Apr 29, 2020 · 2 revisions

setLogLevel( level:LogLevel)
getLogLevel():LogLevel

Get/set the level of log output.

Please note that you can write the log output to a file if you run the node module like this:

node myScript.js > myLog.txt 2>&1

setTranslation( language:ITranslations)
getTranslation( ):ITranslations

Get / set the language of the log output.

The english texts for errors and tasks are hardcoded. You can set a different output language by assigning an { [key: string]:any; } object containing the required templates. See src/languages/german.ts for an example language resource file.

getHost( ):string

Returns the host used to create the client like "https://fsi.myDomain.tld"

getServerBaseQuery( ):string

Returns the URL to use for queries like "https://fsi.myDomain.tld/fsi/server?"

getService( serviceEndpoint:string ):string

Returns the URL to use for service requests like "https://fsi.myDomain.tld/fsi/service/file"

getNewAbortController(): APIAbortController

Returns a new abort controller instance. The abort controller instance can be passed to IOptions or its descendants like IHTTPOptions in order to be able to abort a request.

const abortController = client.getNewAbortController();

client.login("user", "password")
.then( () => {
   client.listServer("images/newDir", {
     "recursive":true,
     "abortController":abortController
   })
   .then( (success) => {
      console.log("listServer finished with result " + success);
    })
    .catch(console.error)
    .finally( () => {
      client.logout();
    });
})
.catch(console.error);


// abort the listServer request
abortController.abort();

Clone this wiki locally