- 
                Notifications
    You must be signed in to change notification settings 
- Fork 17
KZL 174 - Update README for SDK V6 #308
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
Conversation
| Codecov Report
 @@           Coverage Diff           @@
##            6-dev     #308   +/-   ##
=======================================
  Coverage   97.71%   97.71%           
=======================================
  Files          28       28           
  Lines        1401     1401           
=======================================
  Hits         1369     1369           
  Misses         32       32Continue to review full report at Codecov. 
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add a notice within the  About Kuzzle paragraph, saying that this is the documentation for the beta-6 SDK, which has been refactored in deep.
        
          
                README.md
              
                Outdated
          
        
      | ``` | ||
|  | ||
| ## Protocols used | ||
| Actuellement, le SDK supporte nativement 3 protocols: `http`, `websocket` et `socketio`. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be translated into English... ;)
        
          
                README.md
              
                Outdated
          
        
      | ## Protocols used | ||
| Actuellement, le SDK supporte nativement 3 protocols: `http`, `websocket` et `socketio`. | ||
|  | ||
| The main reason behind this is that while Socket.IO offers better compatibility with older web browsers, our raw WebSocket implementation is about 20% faster | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking: remove The main reasion behind this is that
just be decalarative, something like that:
Websocket and Socket.IO protocols implement the whole Kuzzle API, while HTTP protocol does not implement realtime features (rooms and subscriptions)
While Socket.IO offers better compatibility with older web browsers, our raw WebSocket implementation is about 20% faster
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| #### NodeJS | ||
|  | ||
| The protocol used is always raw WebSocket for `websocket`. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not true anymore. We can now choose btw http and websocket (and even socket.io if we want, whereas it is not a pertinent choice), or implement our custom protocol if needed.
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| #### Web Browsers | ||
|  | ||
| If you choose `websocket`, the SDK will first try to use raw WebSocket to connect to Kuzzle. If the web browser does not support this protocol, then the SDK falls back to Socket.IO. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not true anymore: the application must now implement the fallback if we need it.
(maybe give a short example for that.)
        
          
                README.md
              
                Outdated
          
        
      | } | ||
| ``` | ||
|  | ||
| ### ISO with the Kuzzle API | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open suggestion: we could also add an sample code with kuzzle.query method.
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| Any errors must be caught either at the end of the Promise chain, or by using `async/await` and a `try...catch`. | ||
|  | ||
| Translated with www.DeepL.com/Translator | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| The main reason behind this is that while Socket.IO offers better compatibility with older web browsers, our raw WebSocket implementation is about 20% faster | ||
|  | ||
| Which protocol is used when you connect to Kuzzle depends on multiple factors: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What protocol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this sentence
        
          
                README.md
              
                Outdated
          
        
      | } | ||
| ``` | ||
|  | ||
| ### ISO with the Kuzzle API | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frenchism. Proposal: Close implementation of Kuzzle's API or Match Kuzzle's API
        
          
                README.md
              
                Outdated
          
        
      | ``` | ||
|  | ||
| The parameters of each method differ according to the parameters expected in the API. | ||
| To get the details of the parameters of each method, it is necessary for the moment to see the code of each controller on [Github](https://github.com/kuzzleio/sdk-javascript/tree/6-beta/src/controllers). | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Should be removed. If you know API actions that aren't properly documented, write an issue instead so that we can fix these.
Ok I completely misunderstood what you wrote -_-
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| ### Promise based | ||
|  | ||
| Each SDK method returns a Promise resolving on the result of the API return (the `result` property described in the API documentation). | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All SDK methods return a promise resolving the result part of Kuzzle API responses. If an error occurs, the promise is rejected with an Error object embedding the error part of the API response.
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| For example, for the action `create` of the controller `collection` ([collection#create](https://docs.kuzzle.io/api-documentation/controller-collection/create)), the property `result` contains `{ "acknowledged": true} `. This is therefore what will be returned by the SDK method if successful. | ||
|  | ||
| Any errors must be caught either at the end of the Promise chain, or by using `async/await` and a `try...catch`. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any error
It doesn't seem useful to me to explain how a promise should be handled, I think that my proposal above is enough to document how errors are returned by SDK methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel more confident when I see example along the documentation but if you think it's too much I can remove that part.
| .then(serverTime => console.log(serverTime)) | ||
| .catch(error => console.error(error)); | ||
|  | ||
| // With async/await | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of proving an async/await example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reason as above
| hello: { type: 'text' } | ||
| } | ||
| }; | ||
| // Without async/await | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto: I don't think that this async/await example adds anything interesting to our documentation, we should stick to raw promises examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async/await feel more modern than then/catch. With the rise of async/await over raw promises, I think more and more people will be more comfortable with async/await syntax.
        
          
                README.md
              
                Outdated
          
        
      | try { | ||
| const result = await kuzzle.collection.create('my-index', 'my-collection', mapping); | ||
| // result contain { "acknowledged": true } | ||
| console.log('Success'); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(result); seems more appropriate to me
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| You can access the Kuzzle repository on [Github](https://github.com/kuzzleio/kuzzle) | ||
|  | ||
| This is the documentation for the beta-6 SDK. We are currently refactoring in deep our documentation to support many versions of each SDK. You can see it [here](https://docs-v2.kuzzle.io/sdk-reference/kuzzle/constructor/) but notice that this is an beta version of the documentation. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/this is an beta version/this is a beta version/
* KZL 174 - Update README for SDK V6 (#308) * Draft readme * Update README for sdk v6 * Update sdk deploy script to build * Use 6-beta links in github url * Apply change from @ballinette and @scottinet * typo * Release 6.0.0-beta-1 * dependencies update
What does this PR do?
This PR update the README to briefly explain how to use the SDK V6 until the documentation is available.
How should this be manually tested?
Other changes
dist/) to support the6-betabranchBoyscout
.travis.yml