Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feature, csharp): Add RequestOptions #4166

Merged
merged 6 commits into from
Jul 31, 2024
Merged

Conversation

amckinney
Copy link
Contributor

@amckinney amckinney commented Jul 31, 2024

This introduces the RequestOptions type, which exposes the same set of properties as the ClientOptions, but does not include any default values. That way, any option explicitly set by the user at the request call-site will take precedence over the options set on the client constructor.

For example,

var user = client.GetUserAsync(
  new GetUserRequest {
    Username = "john.doe"
  },
  new RequestOptions {
      BaseUrl = "https://localhost:3000"
  }).Result;

This also updates the TimeoutInSeconds option (currently unused) to be a TimeSpan. This is more idiomatic and gives the user more control over exactly how they want to construct the time span before it's passed into the HTTP client.

@amckinney amckinney requested a review from dsinghvi as a code owner July 31, 2024 18:41
Copy link
Contributor

@dcb6 dcb6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants