diff --git a/README.md b/README.md index 2d30a75..c90f452 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,109 @@ NiseLine is inspired by [LocalStack](https://github.com/localstack/localstack). Goal of this tool is to create a mock service for [LINE](https://line.me/ja/). -## Setup +## Getting Started -### Docker +Launch NiseLine server. + +```bash +docker run -d -p 3000:3000 dyoshikawa/niseline:latest +``` + +And install NiseLiff SDK. + +```bash +npm i @niseline/niseliff +``` + +Use NiseLiff sdk in your client app! + +```tsx +import { buildNiseLiff } from '@niseline/niseliff' +import React from 'react' +import ReactDOM from 'react-dom' + +const niseliff = buildNiseLiff() + +niseliff + .init({ + liffId: 'DEFAULT_LIFF_ID', // You can any value + }) + .then(() => { + ReactDOM.render( + Your client app, + document.getElementById('root') + ) + }) +``` + +## NiseLiff SDK + +### Setup + +```bash +npm i @niseline/niseliff +``` + +### Usage + +```tsx +import { buildNiseLiff } from '@niseline/niseliff' +import React from 'react' +import ReactDOM from 'react-dom' + +const niseliff = buildNiseLiff() + +niseliff + .init({ + liffId: 'DEFAULT_LIFF_ID', // You can any value + }) + .then(() => { + ReactDOM.render( + Your client app, + document.getElementById('root') + ) + }) +``` + +### Features + +- [x] [Initialize liff app](https://developers.line.biz/ja/reference/liff/#initialize-liff-app) +- [x] [Get os](https://developers.line.biz/ja/reference/liff/#get-os) +- [x] [Get language](https://developers.line.biz/ja/reference/liff/#get-language) +- [x] [Get version](https://developers.line.biz/ja/reference/liff/#get-version) +- [x] [Get line version](https://developers.line.biz/ja/reference/liff/#get-line-version) +- [x] [Is in client](https://developers.line.biz/ja/reference/liff/#is-in-client) +- [x] [Is logged in](https://developers.line.biz/ja/reference/liff/#is-logged-in) +- [x] [Is api available](https://developers.line.biz/ja/reference/liff/#is-api-available) +- [x] [Login](https://developers.line.biz/ja/reference/liff/#login) +- [x] [Logout](https://developers.line.biz/ja/reference/liff/#logout) +- [x] [Get access token](https://developers.line.biz/ja/reference/liff/#get-access-token) +- [x] [Get ID token](https://developers.line.biz/ja/reference/liff/#get-id-token) +- [x] [Get decoded ID token](https://developers.line.biz/ja/reference/liff/#get-decoded-id-token) +- [x] [Get context](https://developers.line.biz/ja/reference/liff/#get-context) +- [x] [Get profile](https://developers.line.biz/ja/reference/liff/#get-profile) +- [x] [Get friendship](https://developers.line.biz/ja/reference/liff/#get-friendship) +- [ ] [Permission query](https://developers.line.biz/ja/reference/liff/#permission-query) +- [ ] [Permission request all](https://developers.line.biz/ja/reference/liff/#permission-request-all) +- [ ] [Permanent link create url by](https://developers.line.biz/ja/reference/liff/#permanent-link-create-url-by) +- [ ] [Permanent link create url](https://developers.line.biz/ja/reference/liff/#permanent-link-create-url) +- [ ] [Permanent link set extra query param](https://developers.line.biz/ja/reference/liff/#permanent-linke-set-extra-query-param) +- [x] [Send messages](https://developers.line.biz/ja/reference/liff/#send-messages) +- [x] [Open window](https://developers.line.biz/ja/reference/liff/#open-window) +- [ ] [Share target picker](https://developers.line.biz/ja/reference/liff/#share-target-picker) +- [ ] [Scan code v2](https://developers.line.biz/ja/reference/liff/#scan-code-v2) +- [ ] [Scan code](https://developers.line.biz/ja/reference/liff/#scan-code) +- [x] [Close window](https://developers.line.biz/ja/reference/liff/#close-window) +- [x] [Init plugins](https://developers.line.biz/ja/reference/liff/#init-plugins) +- [ ] [Bluetooth get availability](https://developers.line.biz/ja/reference/liff/#bluetooth-get-availability) +- [ ] [Bluetooth request device](https://developers.line.biz/ja/reference/liff/#bluetooth-request-device) +- [ ] [Bluetooth referring device](https://developers.line.biz/ja/reference/liff/#bluetooth-referring-device) + +## NiseLine Server + +### Setup + +#### Docker ```bash docker run -d -p 3000:3000 dyoshikawa/niseline:latest @@ -12,7 +112,7 @@ curl http://localhost:3000/niseline/ping # => {"ping":"pong"} ``` -### Docker Compose +#### Docker Compose ```yaml # docker-compose.yml @@ -30,7 +130,7 @@ curl http://localhost:3000/niseline/ping # => {"ping":"pong"} ``` -## Usage +### Usage ```bash curl --request POST \ @@ -46,9 +146,9 @@ curl -v -X POST 'http://localhost:3000/oauth2/v2.1/verify' \ # => {"iss":"https://example.com","sub":"FOO_ID","aud":"1234567890","exp":1504169092,"iat":1504263657,"nonce":"0987654asdf","amr":["pwd"],"name":"Foo","picture":"http://example.com/foo.jpg","email":"foo@example.com"} ``` -## Features +### Features -### Login API +#### Login API - [ ] [Issue access token](https://developers.line.biz/ja/reference/line-login/#issue-access-token) - [x] [Verify access token](https://developers.line.biz/ja/reference/line-login/#verify-access-token) @@ -58,7 +158,7 @@ curl -v -X POST 'http://localhost:3000/oauth2/v2.1/verify' \ - [x] [Get user profile](https://developers.line.biz/ja/reference/line-login/#get-user-profile) - [x] [Get friendship status](https://developers.line.biz/ja/reference/line-login/#get-friendship-status) -### Messaging API +#### Messaging API - [x] [Send reply message](https://developers.line.biz/ja/reference/messaging-api/#send-reply-message) - [x] [Send push message](https://developers.line.biz/ja/reference/messaging-api/#send-push-message) @@ -74,37 +174,3 @@ curl -v -X POST 'http://localhost:3000/oauth2/v2.1/verify' \ - [ ] [Get number of multicast messages](https://developers.line.biz/ja/reference/messaging-api/#get-number-of-multicast-messages) - [ ] [Get number of broadcast messages](https://developers.line.biz/ja/reference/messaging-api/#get-number-of-broadcast-messages) - [ ] [Retry api request](https://developers.line.biz/ja/reference/messaging-api/#retry-api-request) - -### Client SDK - -- [x] [Initialize liff app](https://developers.line.biz/ja/reference/liff/#initialize-liff-app) -- [x] [Get os](https://developers.line.biz/ja/reference/liff/#get-os) -- [x] [Get language](https://developers.line.biz/ja/reference/liff/#get-language) -- [x] [Get version](https://developers.line.biz/ja/reference/liff/#get-version) -- [x] [Get line version](https://developers.line.biz/ja/reference/liff/#get-line-version) -- [x] [Is in client](https://developers.line.biz/ja/reference/liff/#is-in-client) -- [x] [Is logged in](https://developers.line.biz/ja/reference/liff/#is-logged-in) -- [x] [Is api available](https://developers.line.biz/ja/reference/liff/#is-api-available) -- [x] [Login](https://developers.line.biz/ja/reference/liff/#login) -- [x] [Logout](https://developers.line.biz/ja/reference/liff/#logout) -- [x] [Get access token](https://developers.line.biz/ja/reference/liff/#get-access-token) -- [x] [Get ID token](https://developers.line.biz/ja/reference/liff/#get-id-token) -- [x] [Get decoded ID token](https://developers.line.biz/ja/reference/liff/#get-decoded-id-token) -- [x] [Get context](https://developers.line.biz/ja/reference/liff/#get-context) -- [x] [Get profile](https://developers.line.biz/ja/reference/liff/#get-profile) -- [x] [Get friendship](https://developers.line.biz/ja/reference/liff/#get-friendship) -- [ ] [Permission query](https://developers.line.biz/ja/reference/liff/#permission-query) -- [ ] [Permission request all](https://developers.line.biz/ja/reference/liff/#permission-request-all) -- [ ] [Permanent link create url by](https://developers.line.biz/ja/reference/liff/#permanent-link-create-url-by) -- [ ] [Permanent link create url](https://developers.line.biz/ja/reference/liff/#permanent-link-create-url) -- [ ] [Permanent link set extra query param](https://developers.line.biz/ja/reference/liff/#permanent-linke-set-extra-query-param) -- [x] [Send messages](https://developers.line.biz/ja/reference/liff/#send-messages) -- [x] [Open window](https://developers.line.biz/ja/reference/liff/#open-window) -- [ ] [Share target picker](https://developers.line.biz/ja/reference/liff/#share-target-picker) -- [ ] [Scan code v2](https://developers.line.biz/ja/reference/liff/#scan-code-v2) -- [ ] [Scan code](https://developers.line.biz/ja/reference/liff/#scan-code) -- [x] [Close window](https://developers.line.biz/ja/reference/liff/#close-window) -- [x] [Init plugins](https://developers.line.biz/ja/reference/liff/#init-plugins) -- [ ] [Bluetooth get availability](https://developers.line.biz/ja/reference/liff/#bluetooth-get-availability) -- [ ] [Bluetooth request device](https://developers.line.biz/ja/reference/liff/#bluetooth-request-device) -- [ ] [Bluetooth referring device](https://developers.line.biz/ja/reference/liff/#bluetooth-referring-device) diff --git a/package-lock.json b/package-lock.json index 1c04da4..275972c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12628,7 +12628,7 @@ }, "packages/niseliff-sdk": { "name": "@niseline/niseliff", - "version": "0.1.0", + "version": "0.2.0", "license": "MIT", "dependencies": { "@line/liff": "2.18.1", @@ -12667,7 +12667,7 @@ }, "packages/sample-client-app/packages/niseliff-sdk": {}, "packages/server": { - "version": "0.1.0", + "version": "0.2.0", "license": "MIT", "dependencies": { "ejs": "^3.1.6", diff --git a/packages/niseliff-sdk/package.json b/packages/niseliff-sdk/package.json index 3dacb9f..0faa8f4 100644 --- a/packages/niseliff-sdk/package.json +++ b/packages/niseliff-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@niseline/niseliff", - "version": "0.1.0", + "version": "0.2.0", "private": false, "main": "dist/index.js", "dependencies": { diff --git a/packages/niseliff-sdk/src/index.ts b/packages/niseliff-sdk/src/index.ts index 9076c12..d882af4 100644 --- a/packages/niseliff-sdk/src/index.ts +++ b/packages/niseliff-sdk/src/index.ts @@ -23,7 +23,7 @@ import { buildOpenWindow } from './method/open-window' import { buildSendMessages } from './method/send-messages' import { ConsoleLogger, Logger } from './util/logger' -export const buildClientSdk = (params?: { +export const buildNiseLiff = (params?: { clientEndpoint?: string authEndpoint?: string os?: 'ios' | 'android' | 'web' | undefined diff --git a/packages/sample-client-app/src/main.tsx b/packages/sample-client-app/src/main.tsx index 62a837e..975e22e 100644 --- a/packages/sample-client-app/src/main.tsx +++ b/packages/sample-client-app/src/main.tsx @@ -1,12 +1,12 @@ -import { buildClientSdk } from '@niseline/niseliff' +import { buildNiseLiff } from '@niseline/niseliff' import React from 'react' import ReactDOM from 'react-dom' -const clientSdk = buildClientSdk() +const niseliff = buildNiseLiff() -clientSdk +niseliff .init({ - liffId: 'dummy', + liffId: 'DEFAULT_LIFF_ID', }) .then(() => { ReactDOM.render( diff --git a/packages/server/package.json b/packages/server/package.json index df4a768..82b7cf4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "server", - "version": "0.1.0", + "version": "0.2.0", "description": "", "private": true, "scripts": {