The Spring Social SlideShare is an extension to Spring Social that enables integration with SlideShare API.
This library supports all operations officially provided by SlideShare.
The packages are provided by GitHub Package, and you can find a latest package on packages.
See the following official documentations to install the package from GitHub Package.
repositories {
mavenCentral()
jcenter()
maven("https://repo.spring.io/libs-snapshot")
maven {
url = uri("https://maven.pkg.github.com/t28hub/spring-social-slideshare")
credentials {
username = YOUR_GITHUB_USERNAME
password = YOUR_GITHUB_TOKEN
}
}
}
dependencies {
implementation("io.t28.springframework.social.slideshare:spring-social-slideshare:1.0.0-SNAPSHOT")
}
The Spring Social SlideShare offers integration with SlideShare API through the SlideShare
interface and its implementation, SlideShareTemplate
.
See the official documentation to retrieve the API key and the shared secret.
val credentials = Credentials(
username = "The username of SlideShare",
password = "The password of SlideShare"
)
val slideShare = SlideShareTemplate(
apiKey = "The API key provided by SlideShare", // Required
sharedSecret = "The shared secret provided by SlideShare", // Required
credentials = credentials // Optional
)
Once instantiating a SlideShare class, you can perform the following operations:
Note that the SlideShare API puts your credentials (username and password) to query string as follows:
https://www.slideshare.net/api/2/get_slideshow?slideshow_id=1234567890&username=YOUR_USERNAME&password=YOUR_PASSWORD
This is described in the official documentation as follows:
Requests that request private data from users, or that act on their behalf, must include the following parameters:
- username: set this to the username of the account whose data is being requested.
- password: set this to the password of the account whose data is being requested.
The Spring Social SlideShare also supports auto configuration.
Supported properties are as following:
Property | Description | Required |
---|---|---|
spring.social.slideshare.apiKey |
The API key provided by SlideShare. | true |
spring.social.slideshare.sharedSecret |
The shared secret provided by SlideShare. | true |
spring.social.slideshare.username |
The username of SlideShare. | false |
spring.social.slideshare.password |
The password of SlideShare. | false |
This program retrieves a detailed slideshow information by https://www.slideshare.net/tatsuyamaki39/unit-testinandroid
.
val slideShare = SlideShareTemplate("YOUR_API_KEY", "YOUR_SHARED_SECRET")
val url = "https://www.slideshare.net/tatsuyamaki39/unit-testinandroid"
val options = GetSlideshowOptions(
excludeTags = true,
detailed = true
)
slideShare.slideshowOperations().getSlideshowById(url = url, options = options)
This program searches for slideshows containing kotlin
in English and sorts them by latest.
val slideShare = SlideShareTemplate("YOUR_API_KEY", "YOUR_SHARED_SECRET")
val options = SearchSlideshowsOptions(
language = SearchSlideshowsOptions.Launguage.ENGLISH,
sort = SearchSlideshowsOptions.Sort.LATEST,
what = SearchSlideshowsOptions.SearchType.TEXT
)
slideShare.slideshowOperations().searchSlideshows("kotlin", options)
This program retrieves tags by an authenticated user.
val credentials = Credentials("YOUR_USERNAME", "YOUR_PASSWORD")
val slideShare = SlideShareTemplate("YOUR_API_KEY", "YOUR_SHARED_SECRET", credentials)
slideShare.userOperations().getUserTags()
This program checks whether an authenticated user has already favorited a slideshow with the ID 49627175
.
val credentials = Credentials("YOUR_USERNAME", "YOUR_PASSWORD")
val slideShare = SlideShareTemplate("YOUR_API_KEY", "YOUR_SHARED_SECRET", credentials)
slideShare.favoriteOperations().checkFavorite("49627175")
See spring-social-samples module.
The module is sample Spring Boot application and provides REST APIs using Spring Social SlideShare.
- Get an API key and a shared secret
- See the official documentation.
- Edit
application.properties
- The
application.properties
is located in spring-social-samples/src/main/resources.
spring.social.slideshare.apiKey=YOUR_API_KEY
spring.social.slideshare.sharedSecret=YOUR_SHARED_SECRET
- Run the application
$ ./gradlew :spring-social-samples:bootRun
- Test the application
$ curl localhost:8080
- Test Spring Social SlideShare
- The application provides documentations using Swagger.
- You can access the documentations at
http://localhost:8080/swagger-ui/
from your browser.