From dc4183da07c429ee3c9b8f80db0b4c283320a85a Mon Sep 17 00:00:00 2001 From: nrikiji Date: Sat, 3 Nov 2018 01:09:15 +0900 Subject: [PATCH] feat(line-login): add plugin (#2782) * add line-login * Update index.ts * add params and result type * Update index.ts * Update index.ts --- src/@ionic-native/plugins/line-login/index.ts | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 src/@ionic-native/plugins/line-login/index.ts diff --git a/src/@ionic-native/plugins/line-login/index.ts b/src/@ionic-native/plugins/line-login/index.ts new file mode 100644 index 000000000..a41f10b0e --- /dev/null +++ b/src/@ionic-native/plugins/line-login/index.ts @@ -0,0 +1,137 @@ +import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface LineLoginParams { + /** + * Line Channel ID + */ + channel_id: string; +} + +export interface LineLoginProfile { + /** + * Line User ID + */ + userID: string; + + /** + * Line Profile Image URL + */ + pictureURL: string; + + /** + * Line Profile Name + */ + displayName: string; +} + +export interface LineLoginAccessToken { + /** + * Line Access Token + */ + accessToken: string; + + /** + * Line Access Token Expire Time + */ + expireTime: string; +} + +/** + * @name Line Login + * @description + * The function login, logs out, acquires, verifies, and refreshes the access token. The version of LineSDK you are using is as follows. + * + * @usage + * ```typescript + * import { LineLogin } from '@ionic-native/line-login'; + * + * + * constructor(private lineLogin: LineLogin) { } + * + * ... + * + * + * this.lineLogin.initialize({ channel_id: "xxxxxxxxxx" }) + * + * this.lineLogin.login() + * .then(result => console.log(result)) + * .catch(error => console.log(error)) + * + * ``` + * + * @interfaces + * LineLoginParams + * LineLoginProfile + * LineLoginAccessToken + * + */ +@Plugin({ + pluginName: 'LineLogin', + plugin: 'cordova-line-login-plugin', + pluginRef: 'lineLogin', + repo: 'https://github.com/nrikiji/cordova-line-login-plugin', + install: 'ionic cordova plugin add https://github.com/nrikiji/cordova-line-login-plugin.git --variable LINE_CHANNEL_ID="your_line_channel_id"', + installVariables: ['LINE_CHANNEL_ID'], + platforms: ['Android', 'iOS'] +}) +@Injectable() +export class LineLogin extends IonicNativePlugin { + /** + * Initialize + * @param param LineLoginParams + * @return {Promise} + */ + @Cordova() + initialize(param: LineLoginParams): Promise { + return; + } + + /** + * Login + * @return {Promise} + */ + @Cordova({ + successIndex: 1, + errorIndex: 2 + }) + login(): Promise { + return; + } + + /** + * Logout + * @return {Promise} + */ + @Cordova() + logout(): Promise { + return; + } + + /** + * Get Access Token + * @return {Promise} + */ + @Cordova() + getAccessToken(): Promise { + return; + } + + /** + * Verify AccessToken + * @return {Promise} + */ + @Cordova() + verifyAccessToken(): Promise { + return; + } + + /** + * Refresh Access Token + * @return {Promise} + */ + @Cordova() + refreshAccessToken(): Promise { + return; + } +}