kingoftime-cli/src/kingoftime.ts

34 lines
958 B
TypeScript
Raw Normal View History

import axios from 'axios';
const CHECK_IN_ID = 'qmXXCxw9WEWN3X/YrkMWuQ=='
const CHECK_OUT_ID = 'j8ekmJaw6W3M4w3i6hlSIQ=='
async function kingoftime(operationId: string, token: string, userToken: string) {
const response = await axios({
method: 'post',
//url: 'https://s2.kingtime.jp/gateway/bprgateway',
url: 'https://httpbin.org/anything',
headers: {
'Accept': 'application/json, text/javascript, */*; q=0.01'
},
data: new URLSearchParams({
'id': operationId,
'highAccuracyFlg': 'false',
'credential_code': '40',
'user_token': userToken,
'version': '1.4.2',
'token': token
})
})
console.log(response.data)
}
export async function checkin(token: string, userToken: string): Promise<void> {
await kingoftime(CHECK_IN_ID, token, userToken)
}
export async function checkout(token: string, userToken: string): Promise<void> {
await kingoftime(CHECK_OUT_ID, token, userToken)
}