Skip to content

Commit

Permalink
Add a method for initializing a client.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaline committed Feb 22, 2024
1 parent ad189ec commit cd9fd63
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,26 @@ export class SindriClient {
return !!(this._clientConfig.BASE && this._clientConfig.TOKEN);
}

// }[tags=["latest"]]
/**
* Creates a new {@link SindriClient} client instance. The class itself is not exported, so use
* this method on the exported (or any other) client instance to create a new instance. The new
* instance can be configured and used completely independently from any other instances. For
* example it can use different credentials or a different log level.
*
* @param authOptions - The authentication options for the client, including
* credentials like API keys or tokens. Defaults to an empty object if not provided.
*
* @example
* import sindri from 'sindri';
*
* // Equivalent to: const myClient = new SindriClient({ ... });
* const myClient = sindri.create({ apiKey: 'sindri-mykey-1234'});
*
* @returns The new client instance.
*/
create(authOptions: AuthOptions | undefined): SindriClient {
return new SindriClient(authOptions);
}

/**
* Asynchronously creates and deploys a new circuit, initiating its compilation process. This
Expand Down

0 comments on commit cd9fd63

Please sign in to comment.