Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/samples-compilation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: maven
- name: Building
run: |
mvn clean install -DskipTests=true -Dspotless.apply.skip=true
mvn clean install -DskipTests=true -Dspotless.apply.skip=true -DskipUTs -DskipITs
cd sample-app
mvn -B clean package
cd ../examples
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ To enhance the onboarding experience, the following resources are available:
- Sinch Online Developers Documentation: https://developers.sinch.com
- Java SDK Online Javadoc: https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/latest
- Java SDK Quickstart Repository: A repository with tutorials and templates to help you quickly start a new project: https://github.com/sinch/sinch-sdk-java-quickstart
- Java SDK Snippets Repository: A collection of basic code snippets for reference: https://github.com/sinch/sinch-sdk-java-snippets
- Java SDK Snippets: A collection of basic code snippets for reference: [snippets](examples/snippets/README.md)

## Third-party dependencies
The SDK relies on the following third-party dependencies:
Expand Down
2 changes: 1 addition & 1 deletion examples/compile.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

(cd tutorials/voice/handle-incoming-call && mvn clean package)
(cd snippets && ./compile.sh) || exit 1
19 changes: 19 additions & 0 deletions examples/snippets/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
46 changes: 46 additions & 0 deletions examples/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# sinch-sdk-java-snippets
Sinch Java SDK Code Snippets Repository

This repository contains code snippets related to [Sinch JAVA SDK](https://github.com/sinch/sinch-sdk-java)

Snippets can be used as starting point to support Sinch products from your own application.

## Requirements
- JDK 8 or later
- [Sinch account](https://dashboard.sinch.com)

## Snippet execution
Launcher helpers are provided to execute snippets and minimize time to setup your first Java application based onto Sinch SDK

### Snippets execution settings
When executing a snippet you will need to provide certain information about your Sinch account (credentials, Sinch virtual phone number, ...)

This settings can be placed directly in the snippet source or you can choose to edit the [configuration file](./src/main/resources/config.properties), in which case the settings will be shared and used automatically by each snippet.

### Linux platform
Launch script is [here](./launcher)

Execution:
```shell
cd snippets
launcher <SNIPPET_SOURCE_PATH>
```
Where `SNIPPET_SOURCE_PATH` is path to snippet source (see [Available Snippets](#available-snippets) for available snippets)

e.g.:
```shell
launcher numbers/SearchForAvailableNumbers
...
launcher regions/List

```

## Available Snippets

- Conversation: [README.md](src/main/java/conversation/README.md)
- Mailgun: [README.md](src/main/java/mailgun/README.md)
- Numbers: [README.md](src/main/java/numbers/README.md)
- SMS: [README.md](src/main/java/sms/README.md)
- Verification: [README.md](src/main/java/verification/README.md)
- Voice: [README.md](src/main/java/voice/README.md)

5 changes: 5 additions & 0 deletions examples/snippets/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

mvn clean spotless:apply || exit 1

./mvnw clean compile || exit 1
20 changes: 20 additions & 0 deletions examples/snippets/launcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

SNIPPET=$1

echo "Running \"${SNIPPET}\" snippet"

# change
# directory separator by package separator
# supress '.java' suffix if any
CLSS=$(echo "${SNIPPET}" | sed 's/\//./g;s/\.java$//g')

./mvnw \
-q \
clean \
package \
exec:java \
-Djava.util.logging.config.file=src/main/resources/logging.properties \
-Dexec.mainClass="$CLSS" \
|| exit 1

259 changes: 259 additions & 0 deletions examples/snippets/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading