SinchClientBuilder | sinch-rtc
Description: Documentation for sinch-rtc

# Interface SinchClientBuilder

The SinchClientBuilder class builds a new SinchClient instance.

To construct a SinchClient, the required configuration parameters are:

- Application Key
- Environment host
- UserID

It is optional to specify:

- CLI (Calling-Line Identifier / Caller-ID) that will be used for calls terminated to PSTN (Publicly Switched Telephone Network).
- hmsDeviceToken & hmsApplicationId if Huawei Push is to be used.

interface SinchClientBuilder {
applicationKey(applicationKey: string): SinchClientBuilder;
build(): SinchClient;
callerIdentifier(callerIdentifier: string): SinchClientBuilder;
environmentHost(environmentHost: string): SinchClientBuilder;
fetchApi(
api: (
input: RequestInfo | URL,
init?: RequestInit,
) => Promise<Response>,
): SinchClientBuilder;
mediaStreamFactory(
mediaStreamFactory: MediaStreamFactory,
): SinchClientBuilder;
userId(userId: string): SinchClientBuilder;
videoConfiguration(
videoConfiguration: MediaTrackConstraints,
): SinchClientBuilder;
}

##### Index

### Methods

applicationKey
build
callerIdentifier
environmentHost
fetchApi
mediaStreamFactory
userId
videoConfiguration

## Methods

### applicationKey

- applicationKey(applicationKey: string): SinchClientBuilder

  Sets the application key associated with the SinchClient.

  #### Parameters

  - applicationKey: string

    Must not be null.

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### build

- build(): SinchClient

  Creates the resulting SinchClient.

  #### Returns SinchClient

  A new SinchClient instance.

### callerIdentifier

- callerIdentifier(callerIdentifier: string): SinchClientBuilder

  Sets the caller identifier used when calling with PSTN.

  #### Parameters

  - callerIdentifier: string

    Optional, must not be null

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### environmentHost

- environmentHost(environmentHost: string): SinchClientBuilder

  Sets the environment host associated with the SinchClient.

  #### Parameters

  - environmentHost: string

    Must not be null.

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### fetchApi

- fetchApi(
  api: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
  ): SinchClientBuilder

  Sets the fetch api to be used by rest request. If not set the standard FetchApi will be used.

  #### Parameters

  - api: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

    Optional, must not be null

    - - (input: RequestInfo | URL, init?: RequestInit): Promise<Response>

      - MDN Reference

        #### Parameters

        - input: RequestInfo | URL
        - `Optional`init: RequestInit

        #### Returns Promise<Response>

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### mediaStreamFactory

- mediaStreamFactory(mediaStreamFactory: MediaStreamFactory): SinchClientBuilder

  Overide internal creation of the local MediaStream.

  #### Parameters

  - mediaStreamFactory: MediaStreamFactory

    MediaStream factory

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### userId

- userId(userId: string): SinchClientBuilder

  Sets the user id associated with the SinchClient.

  #### Parameters

  - userId: string

    Must not be null.

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

### videoConfiguration

- videoConfiguration(
  videoConfiguration: MediaTrackConstraints,
  ): SinchClientBuilder

  #### Parameters

  - videoConfiguration: MediaTrackConstraints

    constraints for video

  #### Returns SinchClientBuilder

  The SinchClientBuilder instance.

  #### Deprecated

  Use CallClient.setVideoTrackConstraints instead. Overide internal creation of the local MediaStream.