Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

t28hub/spring-social-slideshare

Repository files navigation

Spring Social SlideShare

GitHub Actions FOSSA Status Quality Gate Status Coverage Apache 2.0

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.

Table of Contents

Installation

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")
}

Usage

API Binding

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.

Auto Configure

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

Examples

Retrieving a slideshow information

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)

Searching slideshows

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)

Retrieving tags by authenticated user

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()

Checking whether a slideshow is favorited

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")

Other examples

See spring-social-samples module.
The module is sample Spring Boot application and provides REST APIs using Spring Social SlideShare.

  1. Get an API key and a shared secret
  1. Edit application.properties
spring.social.slideshare.apiKey=YOUR_API_KEY
spring.social.slideshare.sharedSecret=YOUR_SHARED_SECRET
  1. Run the application
$ ./gradlew :spring-social-samples:bootRun
  1. Test the application
$ curl localhost:8080
  1. Test Spring Social SlideShare
  • The application provides documentations using Swagger.
  • You can access the documentations at http://localhost:8080/swagger-ui/ from your browser.

License

FOSSA Status

Releases

No releases published

Packages

 
 
 

Languages