Skip to content

Configuration

The SDK is configured with the TcgCollectorApiSdk.TcgCollectorApiConfiguration class.

Read from a file

The configuration can be read from a JSON file by using the TcgCollectorApiSdk.TcgCollectorApiConfiguration.ReadFromJsonFileAsync(string filePath) method.

Property Type Is required Description
baseUrl string Yes e.g., https://www.tcgcollector.com/api.
accessToken string Yes

JSON file example

{
  "baseUrl": "https://www.tcgcollector.com/api",
  "accessToken": "access-token"
}

Read from the environment

The configuration can be read from the environment by using the TcgCollectorApiSdk.TcgCollectorApiConfiguration.ReadFromEnvironmentAsync() method. The SDK will look for the TCGCOLLECTOR_API_CONFIG_FILE_PATH environment variable, which is used to refer to a JSON configuration file.

Read from both a file and the environment

Reading from a file and the environment can be combined using the TcgCollectorApiSdk.TcgCollectorApiConfiguration.ReadAsync(string? filePath = null) method. If no file path is passed, the TCGCOLLECTOR_API_CONFIG_FILE_PATH environment variable will be used to look for the configuration file.