File tree Expand file tree Collapse file tree 5 files changed +40
-3
lines changed Expand file tree Collapse file tree 5 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @expressms/smartapp-sdk" ,
3- "version" : " 1.13.0-alpha.9 " ,
3+ "version" : " 1.13.0-alpha.10 " ,
44 "description" : " Smartapp SDK" ,
55 "main" : " build/main/index.js" ,
66 "typings" : " build/main/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export * from './lib/notification'
77export * from './lib/routing'
88export * from './lib/proxy'
99export * from './lib/devices'
10-
1110import Bridge from '@expressms/smartapp-bridge'
12- export { Bridge }
11+ import * as ExpressDisk from './lib/express-disk'
12+
13+ export { Bridge , ExpressDisk }
Original file line number Diff line number Diff line change 1+ import bridge from '@expressms/smartapp-bridge'
2+ import { ERROR_CODES , METHODS } from '../../types'
3+ import { GetAuthCodeResponse } from '../../types/express-disk'
4+
5+ /**
6+ * Get auth code for eXpress Disk
7+ * @returns Promise that'll be fullfilled with `payload.auth` on success, otherwise rejected with reason
8+ */
9+ export const getAuthCode = ( ) : Promise < GetAuthCodeResponse > => {
10+ if ( ! bridge ) return Promise . reject ( ERROR_CODES . NO_BRIDGE )
11+
12+ return bridge
13+ . sendClientEvent ( {
14+ method : METHODS . GET_EXPRESS_DISK_AUTH_CODE ,
15+ params : { } ,
16+ hide_recv_event_data : true ,
17+ } )
18+ . then ( event => event as GetAuthCodeResponse )
19+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export enum METHODS {
5555 WRITE_NFC_TAG = 'write_nfc_tag' ,
5656 ALLOW_IOS_SWIPE_NAVIGATION = 'allow_ios_swipe_navigation' ,
5757 HIDE_RECV_DATA = 'hide_recv_data' ,
58+ GET_EXPRESS_DISK_AUTH_CODE = 'get_express_disk_auth_code' ,
5859}
5960
6061export enum STATUS {
Original file line number Diff line number Diff line change 1+ import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter'
2+ import { STATUS } from './bridge'
3+
4+ export interface GetAuthCodeResponse extends Omit < EmitterEventPayload , 'payload' > {
5+ payload : {
6+ status : STATUS
7+ errorCode ?: string | null
8+ auth : {
9+ diskHost : string
10+ code : string
11+ codeChallenge : null | string
12+ codeChallengeMethod : string
13+ expiresIn : number
14+ }
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments