Skip to content

Commit

Permalink
docs: Flesh out Usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Nov 20, 2024
1 parent 07f7631 commit d4f636e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.vonage/server-sdk-kotlin)](https://central.sonatype.com/artifact/com.vonage/server-sdk-kotlin)
[![Build Status](https://github.com/Vonage/vonage-kotlin-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/Vonage/vonage-kotlin-sdk/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/Vonage/vonage-kotlin-sdk/graph/badge.svg?token=YNBJUD8OUT)](https://codecov.io/gh/Vonage/vonage-kotlin-sdk)
[![KDoc](https://javadoc.io/badge2/com.vonage/server-sdk-kotlin/javadoc.svg)](https://javadoc.io/doc/com.vonage/server-sdk-kotlin)
![SLOC](https://sloc.xyz/github/Vonage/vonage-kotlin-sdk)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt)
Expand Down Expand Up @@ -115,9 +116,30 @@ val vonageClient = Vonage {
```

## Usage

As with our other SDKs, the architecture is based around the `Vonage` class, which defines the authentication
credentials and optional advanced settings for the HTTP client. The class has a field for each supported API,
which returns an object containing methods available on that API. Where the SDK differs from other SDKs is that
it uses a resource-based approach for CRUD operations, rather than a flat list of methods.
These are inner classes defined for each API resources and are always prefixed with `Existing` - for example,
`ExistingCall`, `ExistingSession`, `ExistingApplication` etc. As a general rule, resources with unique identifiers
have a corresponding `Existing[Resource]` class which is used to perform operations on that resource, rather
than repeatedly passing the ID of that resource to methods on the parent class, as is the case in the Java SDK.

### Examples
You can find complete runnable code samples in the [Code Snippets repository](https://github.com/Vonage/vonage-kotlin-code-snippets),
including [a searchable list of snippets](https://github.com/Vonage/vonage-kotlin-code-snippets/blob/main/SNIPPETS.md).

### Documentation
The SDK is fully documented with KDocs, so you should have complete documentation from your IDE. You may need to
click "Download Sources" in IntelliJ to get the full documentation. Alternatively, you can browse the documentation
using a service such as [Javadoc.io](https://javadoc.io/doc/com.vonage/server-sdk-kotlin/latest/index.html), which
renders the documentation for you from [the artifacts on Maven Central](https://repo.maven.apache.org/maven2/com/vonage/server-sdk-kotlin/).

For help with any specific APIs, refer to the relevant documentation on our [developer portal](https://developer.vonage.com/en/documentation),
using the links provided in the [Supported APIs](#supported-apis) section. For completeness, you can also consult the
[API specifications](https://developer.vonage.com/api) if you believe there are any discrepancies.

## Frequently Asked Questions

**Q: Why use this SDK instead of the [Vonage Java Server SDK](https://github.com/Vonage/vonage-java-sdk)?**
Expand All @@ -126,14 +148,20 @@ including [a searchable list of snippets](https://github.com/Vonage/vonage-kotli
syntactic sugar, so you can avoid the cumbersome builder pattern in favour of a more idiomatic DSL-like
syntax, optional and named parameters with default values etc. whilst still reataining the strong typing
offered by the Java SDK. Furthermore, you are more partially shielded from "platform types" (the `!`)
so you have a better idea of what is and isn't nullable when creating requests.
so you have a better idea of what is and isn't nullable when creating requests. You can read more about the
differences in [the v1.0.0 announcement blog post](https://developer.vonage.com/en/blog/announcing-the-vonage-kotlin-server-sdk).

**Q: What is your policy on thread safety?**

**A:** As with the Java Server SDK, only one thread should use the client at a time.
If you would like to use the SDK in a multithreaded environment, create a separate instance of
`Vonage` for each thread, or use a ThreadLocal instance.

**Q: I'm having issues with my project when including the SDK as a dependency. How can I troubleshoot this?**

**A:** Please see [this blog post](https://developer.vonage.com/en/blog/one-simple-trick-for-resolving-java-runtime-dependency-issues).
In short, you may have conflicting dependency versions in your project which clash with this SDK's transitive dependencies.

## Contribute!

_We :heart: contributions to this library!_
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.vonage</groupId>
<artifactId>server-sdk-kotlin</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>

<name>Vonage Kotlin Server SDK</name>
<description>Kotlin client for Vonage APIs</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/vonage/client/kt/Vonage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.vonage.client.kt
import com.vonage.client.HttpConfig
import com.vonage.client.VonageClient

const val VONAGE_KOTLIN_SDK_VERSION = "1.1.0"
const val VONAGE_KOTLIN_SDK_VERSION = "1.1.1"
private const val SDK_USER_AGENT = "vonage-kotlin-sdk/$VONAGE_KOTLIN_SDK_VERSION"

/**
Expand Down

0 comments on commit d4f636e

Please sign in to comment.