Skip to content

Added back all missing Async API functions - #1800

Merged
alexeyzimarev merged 1 commit into
restsharp:devfrom
kendallb:feature/restore-sync-functions
Apr 4, 2022
Merged

alexeyzimarev merged 1 commit into
restsharp:devfrom
kendallb:feature/restore-sync-functions

Conversation

@kendallb

Copy link
Copy Markdown
Contributor

Added back all missing Async API functions (except for json streaming via async not sure how to convert that one).

… via async not sure how to convert that one).
/// Executes the request synchronously, authenticating if needed
/// </summary>
/// <param name="request">Request to be executed</param>
public RestResponse Execute(RestRequest request) => AsyncHelpers.RunSync(() => ExecuteAsync(request));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need it here, or can it be an extension?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems simple enough to put it there, but it could be moved to RestClientExtensions I suppose? What would you prefer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The question is if it should be a part of the potentially returned IRestClient interface. Do you think it makes sense to keep non-async methods as the core functionality?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think they should be part of the core functionality and if there was an IRestClient interface, it should include the non-async functions as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There could be two interfaces, one for sync and one for non to keep it clean, but IRestClient should inherit both as many people will use both sync and async in their code.

@alexeyzimarev
alexeyzimarev merged commit d43ce02 into restsharp:dev Apr 4, 2022
@kendallb
kendallb deleted the feature/restore-sync-functions branch April 4, 2022 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants