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

Commit

Permalink
Merge pull request #24 from cm-dyoshikawa/readme
Browse files Browse the repository at this point in the history
fix readme and niseliff-sdk
  • Loading branch information
cm-dyoshikawa authored Jan 17, 2022
2 parents 3e06afc + a5b36d0 commit 8c66af9
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 50 deletions.
148 changes: 107 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,117 @@

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(
<React.StrictMode>Your client app</React.StrictMode>,
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(
<React.StrictMode>Your client app</React.StrictMode>,
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
curl http://localhost:3000/niseline/ping
# => {"ping":"pong"}
```

### Docker Compose
#### Docker Compose

```yaml
# docker-compose.yml
Expand All @@ -30,7 +130,7 @@ curl http://localhost:3000/niseline/ping
# => {"ping":"pong"}
```

## Usage
### Usage

```bash
curl --request POST \
Expand All @@ -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":"[email protected]"}
```

## 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)
Expand All @@ -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)
Expand All @@ -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)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/niseliff-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@niseline/niseliff",
"version": "0.1.0",
"version": "0.2.0",
"private": false,
"main": "dist/index.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/niseliff-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions packages/sample-client-app/src/main.tsx
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"private": true,
"scripts": {
Expand Down

0 comments on commit 8c66af9

Please sign in to comment.