Giter Site home page Giter Site logo

clova-cek-sdk-kotlin's Introduction

clova-cek-sdk-kotlin

This is clova extension sdk for kotlin. You can use this sdk with any server-side frameworks like Spring, Armeria, etc.

This SDK contains several libraries.

  • core (mandatory): The core functions of Clova extension
  • data converter (optional): The json converter for Clova, it supports those json libraries
    • Jackson
  • echo: The sample of clova extension based on Spring WebFlux.
  • echo-mvc: The sample of clova extension based Spring MVC.

Because this SDK supports coroutines, please use Kotlin 1.1+.

Setup

Add the configurations in the build.gradle as follows.

repositories {
    jcenter()
}

dependencies {
    //Mandatory
    implementation "com.linecorp:clova-extension-core:1.1.1"

    //Optional
    implementation "com.linecorp:clova-extension-converter-jackson:1.1.1" //the data convertor for jackson
}

Getting started

To get started with the sdk, define the ClovaClient as follows

val client: ClovaClient = clovaClient("application.id") {
    objectMapper = JacksonObjectMapper() //it is must, use pre-defined object mapper (based on Jackson) or to create custom object mapper
      
    launchHandler { launchRequest, session ->
        //Add your implementation
    }

    intentHandler { intentRequest, session ->
        //Add your implementation
    }

    sessionEndedHandler { sessionEndedRequest, session ->
        //Add your implementation
    }
}

Handle the request

You just need to call handleCustomExtensionRequest in your route handler

val response = client.handleClovaRequest(requestBody, httpHeaders)

requestBody and response is the json string.

Coroutine support

You can use suspend function in the handler directly as follows.

launchHandler { launchRequest, session ->
    delay(1000)
    //implement here
}

Or if you want to handle the clova request inside coroutine scope, you can use handleClovaRequestSuspend

asyc {
    client.handleClovaRequestSuspend(requestBody, httpHeaders)
}

To see the tutorial, please check tutorial

References

clova-cek-sdk-kotlin's People

Contributors

syleeeee avatar uich avatar wangyung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clova-cek-sdk-kotlin's Issues

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.