Skip to content

Commit

Permalink
Merge pull request #60 from deepgram/http-timeout
Browse files Browse the repository at this point in the history
Add ability to set HttpClient timeout
  • Loading branch information
briancbarrow authored Jan 17, 2023
2 parents 01e0a03 + 9e6310d commit a20c1ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Deepgram.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Deepgram", "Deepgram\Deepgram.csproj", "{B8B59E33-2D73-4A27-8FC6-E464CB28357D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deepgram.Tests", "Deepgram.Tests\Deepgram.Tests.csproj", "{12C80273-08DD-494C-B06D-DFC6D40B1D95}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Deepgram.Tests", "Deepgram.Tests\Deepgram.Tests.csproj", "{12C80273-08DD-494C-B06D-DFC6D40B1D95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
13 changes: 10 additions & 3 deletions Deepgram/DeepgramClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public Credentials Credentials
}
}

public DeepgramClient()
public DeepgramClient() : this(null)
{
InitializeCredentials();
InitializeClients();
}

public DeepgramClient(Credentials credentials)
Expand All @@ -33,6 +31,15 @@ public DeepgramClient(Credentials credentials)
InitializeClients();
}

/// <summary>
/// Sets the Timeout of the HTTPClient used to send HTTP requests
/// </summary>
/// <param name="timeout">Timespan to wait before the request times out.</param>
public void SetHttpClientTimeout(TimeSpan timeout)
{
Configuration.Instance.Client.Timeout = timeout;
}

public IKeyClient Keys { get; private set; }
public IProjectClient Projects { get; private set; }
public ITranscriptionClient Transcription { get; private set; }
Expand Down

0 comments on commit a20c1ac

Please sign in to comment.