Skip to content

Commit

Permalink
feat(line-login): add plugin (#2782)
Browse files Browse the repository at this point in the history
* add line-login

* Update index.ts

* add params and result type

* Update index.ts

* Update index.ts
  • Loading branch information
nrikiji authored and danielsogl committed Nov 2, 2018
1 parent b61b339 commit dc4183d
Showing 1 changed file with 137 additions and 0 deletions.
137 changes: 137 additions & 0 deletions src/@ionic-native/plugins/line-login/index.ts
Original file line number Diff line number Diff line change
@@ -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<any>}
*/
@Cordova()
initialize(param: LineLoginParams): Promise<any> {
return;
}

/**
* Login
* @return {Promise<LineLoginProfile>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
login(): Promise<LineLoginProfile> {
return;
}

/**
* Logout
* @return {Promise<any>}
*/
@Cordova()
logout(): Promise<any> {
return;
}

/**
* Get Access Token
* @return {Promise<LineLoginAccessToken>}
*/
@Cordova()
getAccessToken(): Promise<LineLoginAccessToken> {
return;
}

/**
* Verify AccessToken
* @return {Promise<any>}
*/
@Cordova()
verifyAccessToken(): Promise<any> {
return;
}

/**
* Refresh Access Token
* @return {Promise<any>}
*/
@Cordova()
refreshAccessToken(): Promise<any> {
return;
}
}

0 comments on commit dc4183d

Please sign in to comment.