Skip to content

Conversation

@Aschen
Copy link
Contributor

@Aschen Aschen commented Sep 10, 2018

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?

  • Step 1 : Read the readme, try the code example

Other changes

  • update deploy script (the one who build the dist/) to support the 6-beta branch

Boyscout

  • cosmetics on .travis.yml

@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #308 into 6-dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##            6-dev     #308   +/-   ##
=======================================
  Coverage   97.71%   97.71%           
=======================================
  Files          28       28           
  Lines        1401     1401           
=======================================
  Hits         1369     1369           
  Misses         32       32

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 ba27a31...a240203. Read the comment docs.

Copy link

@ballinette ballinette left a 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`.

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

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`.

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.

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

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

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😅

@scottinet scottinet changed the base branch from 6-beta to 6-dev September 11, 2018 08:46
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:
Copy link
Contributor

Choose a reason for hiding this comment

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

What protocol

Copy link
Contributor Author

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
Copy link
Contributor

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).
Copy link
Contributor

@scottinet scottinet Sep 11, 2018

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).
Copy link
Contributor

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`.
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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');
Copy link
Contributor

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.

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/

@scottinet scottinet merged commit f3a7a0e into 6-dev Sep 12, 2018
@scottinet scottinet deleted the KZL-174/beta-version-sdk-6 branch September 12, 2018 15:36
@scottinet scottinet mentioned this pull request Sep 13, 2018
scottinet added a commit that referenced this pull request Sep 13, 2018
* 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
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.

5 participants