Skip to content

Commit dc4183d

Browse files
nrikijidanielsogl
authored andcommitted
feat(line-login): add plugin (#2782)
* add line-login * Update index.ts * add params and result type * Update index.ts * Update index.ts
1 parent b61b339 commit dc4183d

File tree

1 file changed

+137
-0
lines changed
  • src/@ionic-native/plugins/line-login

1 file changed

+137
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import { Injectable } from '@angular/core';
2+
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
3+
4+
export interface LineLoginParams {
5+
/**
6+
* Line Channel ID
7+
*/
8+
channel_id: string;
9+
}
10+
11+
export interface LineLoginProfile {
12+
/**
13+
* Line User ID
14+
*/
15+
userID: string;
16+
17+
/**
18+
* Line Profile Image URL
19+
*/
20+
pictureURL: string;
21+
22+
/**
23+
* Line Profile Name
24+
*/
25+
displayName: string;
26+
}
27+
28+
export interface LineLoginAccessToken {
29+
/**
30+
* Line Access Token
31+
*/
32+
accessToken: string;
33+
34+
/**
35+
* Line Access Token Expire Time
36+
*/
37+
expireTime: string;
38+
}
39+
40+
/**
41+
* @name Line Login
42+
* @description
43+
* The function login, logs out, acquires, verifies, and refreshes the access token. The version of LineSDK you are using is as follows.
44+
*
45+
* @usage
46+
* ```typescript
47+
* import { LineLogin } from '@ionic-native/line-login';
48+
*
49+
*
50+
* constructor(private lineLogin: LineLogin) { }
51+
*
52+
* ...
53+
*
54+
*
55+
* this.lineLogin.initialize({ channel_id: "xxxxxxxxxx" })
56+
*
57+
* this.lineLogin.login()
58+
* .then(result => console.log(result))
59+
* .catch(error => console.log(error))
60+
*
61+
* ```
62+
*
63+
* @interfaces
64+
* LineLoginParams
65+
* LineLoginProfile
66+
* LineLoginAccessToken
67+
*
68+
*/
69+
@Plugin({
70+
pluginName: 'LineLogin',
71+
plugin: 'cordova-line-login-plugin',
72+
pluginRef: 'lineLogin',
73+
repo: 'https://github.com/nrikiji/cordova-line-login-plugin',
74+
install: 'ionic cordova plugin add https://github.com/nrikiji/cordova-line-login-plugin.git --variable LINE_CHANNEL_ID="your_line_channel_id"',
75+
installVariables: ['LINE_CHANNEL_ID'],
76+
platforms: ['Android', 'iOS']
77+
})
78+
@Injectable()
79+
export class LineLogin extends IonicNativePlugin {
80+
/**
81+
* Initialize
82+
* @param param LineLoginParams
83+
* @return {Promise<any>}
84+
*/
85+
@Cordova()
86+
initialize(param: LineLoginParams): Promise<any> {
87+
return;
88+
}
89+
90+
/**
91+
* Login
92+
* @return {Promise<LineLoginProfile>}
93+
*/
94+
@Cordova({
95+
successIndex: 1,
96+
errorIndex: 2
97+
})
98+
login(): Promise<LineLoginProfile> {
99+
return;
100+
}
101+
102+
/**
103+
* Logout
104+
* @return {Promise<any>}
105+
*/
106+
@Cordova()
107+
logout(): Promise<any> {
108+
return;
109+
}
110+
111+
/**
112+
* Get Access Token
113+
* @return {Promise<LineLoginAccessToken>}
114+
*/
115+
@Cordova()
116+
getAccessToken(): Promise<LineLoginAccessToken> {
117+
return;
118+
}
119+
120+
/**
121+
* Verify AccessToken
122+
* @return {Promise<any>}
123+
*/
124+
@Cordova()
125+
verifyAccessToken(): Promise<any> {
126+
return;
127+
}
128+
129+
/**
130+
* Refresh Access Token
131+
* @return {Promise<any>}
132+
*/
133+
@Cordova()
134+
refreshAccessToken(): Promise<any> {
135+
return;
136+
}
137+
}

0 commit comments

Comments
 (0)