Skip to content

Commit f4c7929

Browse files
authored
Move snippet files from snippets repo to SDK repository (#290)
* feat (tutorials): Remove obsolete tutorial * feat (Snippets): Moving snippets from 'snippets' repository to 'examples' directory * test (Examples): Remove tests execution from SDK compilation for examples compilation * doc: README update
1 parent 64c84f1 commit f4c7929

146 files changed

Lines changed: 7422 additions & 299 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/samples-compilation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
cache: maven
1818
- name: Building
1919
run: |
20-
mvn clean install -DskipTests=true -Dspotless.apply.skip=true
20+
mvn clean install -DskipTests=true -Dspotless.apply.skip=true -DskipUTs -DskipITs
2121
cd sample-app
2222
mvn -B clean package
2323
cd ../examples

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ To enhance the onboarding experience, the following resources are available:
114114
- Sinch Online Developers Documentation: https://developers.sinch.com
115115
- Java SDK Online Javadoc: https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/latest
116116
- 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
117-
- Java SDK Snippets Repository: A collection of basic code snippets for reference: https://github.com/sinch/sinch-sdk-java-snippets
117+
- Java SDK Snippets: A collection of basic code snippets for reference: [snippets](examples/snippets/README.md)
118118

119119
## Third-party dependencies
120120
The SDK relies on the following third-party dependencies:

examples/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
(cd tutorials/voice/handle-incoming-call && mvn clean package)
3+
(cd snippets && ./compile.sh) || exit 1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

examples/snippets/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# sinch-sdk-java-snippets
2+
Sinch Java SDK Code Snippets Repository
3+
4+
This repository contains code snippets related to [Sinch JAVA SDK](https://github.com/sinch/sinch-sdk-java)
5+
6+
Snippets can be used as starting point to support Sinch products from your own application.
7+
8+
## Requirements
9+
- JDK 8 or later
10+
- [Sinch account](https://dashboard.sinch.com)
11+
12+
## Snippet execution
13+
Launcher helpers are provided to execute snippets and minimize time to setup your first Java application based onto Sinch SDK
14+
15+
### Snippets execution settings
16+
When executing a snippet you will need to provide certain information about your Sinch account (credentials, Sinch virtual phone number, ...)
17+
18+
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.
19+
20+
### Linux platform
21+
Launch script is [here](./launcher)
22+
23+
Execution:
24+
```shell
25+
cd snippets
26+
launcher <SNIPPET_SOURCE_PATH>
27+
```
28+
Where `SNIPPET_SOURCE_PATH` is path to snippet source (see [Available Snippets](#available-snippets) for available snippets)
29+
30+
e.g.:
31+
```shell
32+
launcher numbers/SearchForAvailableNumbers
33+
...
34+
launcher regions/List
35+
36+
```
37+
38+
## Available Snippets
39+
40+
- Conversation: [README.md](src/main/java/conversation/README.md)
41+
- Mailgun: [README.md](src/main/java/mailgun/README.md)
42+
- Numbers: [README.md](src/main/java/numbers/README.md)
43+
- SMS: [README.md](src/main/java/sms/README.md)
44+
- Verification: [README.md](src/main/java/verification/README.md)
45+
- Voice: [README.md](src/main/java/voice/README.md)
46+

examples/snippets/compile.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
mvn clean spotless:apply || exit 1
4+
5+
./mvnw clean compile || exit 1

examples/snippets/launcher

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
SNIPPET=$1
4+
5+
echo "Running \"${SNIPPET}\" snippet"
6+
7+
# change
8+
# directory separator by package separator
9+
# supress '.java' suffix if any
10+
CLSS=$(echo "${SNIPPET}" | sed 's/\//./g;s/\.java$//g')
11+
12+
./mvnw \
13+
-q \
14+
clean \
15+
package \
16+
exec:java \
17+
-Djava.util.logging.config.file=src/main/resources/logging.properties \
18+
-Dexec.mainClass="$CLSS" \
19+
|| exit 1
20+

examples/snippets/mvnw

Lines changed: 259 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)