Giter VIP home page Giter VIP logo

spring-social-slideshare's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.