Skip to content

Conversation

@scottinet
Copy link
Contributor

@scottinet scottinet commented Jun 19, 2019

⚠️ depends on #13

Description

After a long and heated debate, we adopted a different and more idiomatic way of passing optional parameters to methods.

It goes like this:

  • as long as optional arguments are local to the called function (not passed around, not saved, discarded once the function is finished): the options are to be passed as default arguments. It doesn't matter if there are many optional arguments, as C# allows named parameters
  • if optional arguments needs to be passed around or kept after the function finishes, then they must be put in a dedicated class

Examples:

  • the function responsible of the document:update API (DocumentController.UpdateAsync) now takes both a bool waitForRefresh and a int? retryOnConflict optional arguments
  • search options needs to be kept after DocumentController.SearchAsync finishes, as it is passed to the SearchResult instances that are created afterward to handle search pagination: so the SearchOptions object is unchanged

scottinet and others added 29 commits June 5, 2019 11:32
@scottinet scottinet self-assigned this Jun 19, 2019
@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #14 into 0-dev will increase coverage by 26.79%.
The diff coverage is 38.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           0-dev      #14       +/-   ##
==========================================
+ Coverage   3.45%   30.25%   +26.79%     
==========================================
  Files         19       17        -2     
  Lines        898      876       -22     
  Branches     107      105        -2     
==========================================
+ Hits          31      265      +234     
+ Misses       866      610      -256     
  Partials       1        1
Impacted Files Coverage Δ
Kuzzle/Kuzzle.cs 0% <0%> (ø) ⬆️
Kuzzle/API/Controllers/DocumentController.cs 0% <0%> (ø) ⬆️
Kuzzle/API/Options/SearchOptions.cs 100% <100%> (+100%) ⬆️
Kuzzle/API/Controllers/CollectionController.cs 100% <100%> (+100%) ⬆️
Kuzzle/API/Controllers/AuthController.cs 100% <100%> (+84.73%) ⬆️
Kuzzle/API/DataObjects/SearchResults.cs 26.47% <0%> (+26.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e56f553...6372c3b. Read the comment docs.

@jenow jenow merged commit 1ad39a3 into 0-dev Jun 24, 2019
@scottinet scottinet mentioned this pull request Jul 17, 2019
scottinet added a commit that referenced this pull request Jul 18, 2019
# [0.2.0](https://github.com/kuzzleio/sdk-csharp/releases/tag/0.2.0) (2019-07-17)


#### New features

- [ [#22](#22) ] Add Admin controller and unit tests   ([Shiranuit](https://github.com/Shiranuit))
- [ [#23](#23) ] Add Index Controller   ([alexandrebouthinon](https://github.com/alexandrebouthinon))

#### Enhancements

- [ [#14](#14) ] Fix optional parameters design   ([scottinet](https://github.com/scottinet))
- [ [#13](#13) ] Add unit tests for the collection controller   ([scottinet](https://github.com/scottinet))
- [ [#12](#12) ] Add unit tests for the auth controller   ([scottinet](https://github.com/scottinet))
- [ [#11](#11) ] Initialize unit tests project   ([scottinet](https://github.com/scottinet))

#### Others

- [ [#24](#24) ] Rewrite WebSocket class   ([scottinet](https://github.com/scottinet), [alexandrebouthinon](https://github.com/alexandrebouthinon))
- [ [#20](#20) ] Add documentation runner   ([Aschen](https://github.com/Aschen))
- [ [#18](#18) ] Add unit test for Realtime Controller    ([ThomasF34](https://github.com/ThomasF34))
- [ [#17](#17) ] Unit tests kuzzle class   ([Aschen](https://github.com/Aschen))
- [ [#16](#16) ] Add unit tests for the server controller   ([ThomasF34](https://github.com/ThomasF34))
- [ [#15](#15) ] Add unit tests for the document controller   ([scottinet](https://github.com/scottinet))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants