kingoftime-cli/src/kingoftime.ts

40 lines
1 KiB
TypeScript
Raw Normal View History

2023-04-14 16:50:13 +00:00
import axios from 'axios'
const CHECK_IN_ID = 'qmXXCxw9WEWN3X/YrkMWuQ=='
const CHECK_OUT_ID = 'j8ekmJaw6W3M4w3i6hlSIQ=='
2023-04-26 15:30:46 +00:00
async function kingoftime(
operationId: string,
token: string,
userToken: string,
) {
const response = await axios({
method: 'post',
2023-04-14 16:50:13 +00:00
// url: 'https://s2.kingtime.jp/gateway/bprgateway',
url: 'https://httpbin.org/anything',
headers: {
2023-04-14 16:50:13 +00:00
Accept: 'application/json, text/javascript, */*; q=0.01',
},
data: new URLSearchParams({
2023-04-14 16:50:13 +00:00
id: operationId,
highAccuracyFlg: 'false',
credential_code: '40', // eslint-disable-line camelcase
user_token: userToken, // eslint-disable-line camelcase
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)
}
2023-04-26 15:30:46 +00:00
export async function checkout(
token: string,
userToken: string,
): Promise<void> {
await kingoftime(CHECK_OUT_ID, token, userToken)
}