Skip to content

Commit

Permalink
Docs revision (#248)
Browse files Browse the repository at this point in the history
* docs: correcting session opening on kdocs

* Adding docs to Encoding constants + making 'default' public.

* Fix docs
  • Loading branch information
DariusIMP authored Oct 1, 2024
1 parent adbb6e5 commit 77ca2f8
Show file tree
Hide file tree
Showing 6 changed files with 466 additions and 31 deletions.
34 changes: 17 additions & 17 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess {
* Zenoh.open(Config.default()).onSuccess {
* it.use { session ->
* "demo/kotlin/greeting".intoKeyExpr().onSuccess { keyExpr ->
* session.declarePublisher(keyExpr).onSuccess { pub ->
Expand Down Expand Up @@ -142,7 +142,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "demo/kotlin/sub".intoKeyExpr().onSuccess { keyExpr ->
* session.declareSubscriber(keyExpr, callback = { sample -> println(sample) }).onSuccess {
Expand Down Expand Up @@ -183,7 +183,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
* override fun onClose() = println("Closing handler")
* }
*
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "demo/kotlin/sub".intoKeyExpr().onSuccess { keyExpr ->
* session.declareSubscriber(keyExpr, handler = ExampleHandler())
Expand Down Expand Up @@ -220,7 +220,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
* Example:
* ```kotlin
*
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "demo/kotlin/sub".intoKeyExpr().onSuccess { keyExpr ->
* val samplesChannel = Channel()
Expand Down Expand Up @@ -260,7 +260,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session -> session.use {
* Zenoh.open(Config.default()).onSuccess { session -> session.use {
* "demo/kotlin/greeting".intoKeyExpr().onSuccess { keyExpr ->
* println("Declaring Queryable")
* val queryable = session.declareQueryable(keyExpr, callback = { query ->
Expand Down Expand Up @@ -306,7 +306,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Then we'd use it as follows:
* ```kotlin
* Session.open(Config.default()).onSuccess { session -> session.use {
* Zenoh.open(Config.default()).onSuccess { session -> session.use {
* "demo/kotlin/greeting".intoKeyExpr().onSuccess { keyExpr ->
* println("Declaring Queryable")
* val exampleHandler = ExampleHandler()
Expand Down Expand Up @@ -340,7 +340,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(config).onSuccess { session ->
* Zenoh.open(config).onSuccess { session ->
* session.use {
* key.intoKeyExpr().onSuccess { keyExpr ->
* println("Declaring Queryable on $key...")
Expand Down Expand Up @@ -400,7 +400,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session -> session.use {
* Zenoh.open(Config.default()).onSuccess { session -> session.use {
* val keyExpr = session.declareKeyExpr("demo/kotlin/example").getOrThrow()
* for (i in 0..999) {
* put(keyExpr, "Put number $i!")
Expand Down Expand Up @@ -438,7 +438,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
* A callback must be provided to handle the incoming replies. A basic query can be achieved
* as follows:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* session.get(selector, callback = { reply -> println(reply) })
Expand All @@ -452,7 +452,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* session.get(
Expand Down Expand Up @@ -536,7 +536,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* then we could use it as follows:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* val handler = QueueHandler<Reply>()
Expand All @@ -555,7 +555,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* val handler = QueueHandler<Reply>()
Expand Down Expand Up @@ -627,7 +627,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* session.get(selector, channel = Channel()).onSuccess { channel ->
Expand All @@ -650,7 +650,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
* Example:
*
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoSelector().onSuccess { selector ->
* session.get(selector,
Expand Down Expand Up @@ -721,7 +721,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(config).onSuccess { session ->
* Zenoh.open(config).onSuccess { session ->
* session.use {
* "a/b/c".intoKeyExpr().onSuccess { keyExpr ->
* session.put(keyExpr, payload = "Example payload".into()).getOrThrow()
Expand All @@ -733,7 +733,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Additionally, a [QoS] configuration can be specified as well as an attachment, for instance:
* ```kotlin
* Session.open(Config.default()).onSuccess { session ->
* Zenoh.open(Config.default()).onSuccess { session ->
* session.use {
* "a/b/c".intoKeyExpr().onSuccess { keyExpr ->
* val exampleQoS = QoS(
Expand Down Expand Up @@ -777,7 +777,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
*
* Example:
* ```kotlin
* Session.open(config).onSuccess { session ->
* Zenoh.open(config).onSuccess { session ->
* session.use {
* key.intoKeyExpr().onSuccess { keyExpr ->
* println("Deleting resources matching '$keyExpr'...")
Expand Down
Loading

0 comments on commit 77ca2f8

Please sign in to comment.