mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
export API.
This commit is contained in:
parent
c7fde94ac4
commit
c796a9e530
@ -16,15 +16,14 @@ export class NekoApi {
|
|||||||
this.api_configuration = new Api.Configuration()
|
this.api_configuration = new Api.Configuration()
|
||||||
}
|
}
|
||||||
|
|
||||||
get admin(): Api.AdminsApi {
|
get room(): RoomApi {
|
||||||
return new Api.AdminsApi(this.api_configuration)
|
return new Api.RoomApi(this.api_configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
get user(): Api.UsersApi {
|
get members(): MembersApi {
|
||||||
return new Api.UsersApi(this.api_configuration)
|
return new Api.MembersApi(this.api_configuration)
|
||||||
}
|
|
||||||
|
|
||||||
get host(): Api.HostsApi {
|
|
||||||
return new Api.HostsApi(this.api_configuration)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type RoomApi = Api.RoomApi
|
||||||
|
export type MembersApi = Api.MembersApi
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
import ResizeObserver from 'resize-observer-polyfill'
|
import ResizeObserver from 'resize-observer-polyfill'
|
||||||
import EventEmitter from 'eventemitter3'
|
import EventEmitter from 'eventemitter3'
|
||||||
|
|
||||||
import { NekoApi } from './internal/api'
|
import { NekoApi, MembersApi, RoomApi } from './internal/api'
|
||||||
import { NekoWebSocket } from './internal/websocket'
|
import { NekoWebSocket } from './internal/websocket'
|
||||||
import { NekoWebRTC } from './internal/webrtc'
|
import { NekoWebRTC } from './internal/webrtc'
|
||||||
import { NekoMessages } from './internal/messages'
|
import { NekoMessages } from './internal/messages'
|
||||||
@ -223,67 +223,41 @@
|
|||||||
|
|
||||||
public setClipboardData(text: string) {
|
public setClipboardData(text: string) {
|
||||||
const clipboardPayload = { text }
|
const clipboardPayload = { text }
|
||||||
this.api.host.clipboardWrite({ clipboardPayload })
|
this.api.room.clipboardWrite({ clipboardPayload })
|
||||||
}
|
}
|
||||||
|
|
||||||
public requestControl() {
|
public requestControl() {
|
||||||
this.api.user.controlRequest()
|
this.api.room.controlRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
public releaseControl() {
|
public releaseControl() {
|
||||||
this.api.user.controlRelease()
|
this.api.room.controlRelease()
|
||||||
}
|
}
|
||||||
|
|
||||||
public takeControl() {
|
public takeControl() {
|
||||||
this.api.admin.controlTake()
|
this.api.room.controlTake()
|
||||||
}
|
}
|
||||||
|
|
||||||
public giveControl(id: string) {
|
public giveControl(id: string) {
|
||||||
const controlTargetPayload = { id }
|
const controlTargetPayload = { id }
|
||||||
this.api.admin.controlGive({ controlTargetPayload })
|
this.api.room.controlGive({ controlTargetPayload })
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetControl() {
|
public resetControl() {
|
||||||
this.api.admin.controlReset()
|
this.api.room.controlReset()
|
||||||
}
|
}
|
||||||
|
|
||||||
public setScreenSize(width: number, height: number, rate: number) {
|
public setScreenSize(width: number, height: number, rate: number) {
|
||||||
//this.api.admin.screenConfigurationChange({ screenConfigurationPayload: { width, height, rate } })
|
//this.api.room.screenConfigurationChange({ screenConfigurationPayload: { width, height, rate } })
|
||||||
this.websocket.send('screen/set', { width, height, rate })
|
this.websocket.send('screen/set', { width, height, rate })
|
||||||
}
|
}
|
||||||
|
|
||||||
public memberCreate(memberDataPayload: {
|
public get room(): RoomApi {
|
||||||
id: string
|
return this.api.room
|
||||||
secret: string
|
|
||||||
name: string
|
|
||||||
isAdmin: boolean
|
|
||||||
canLogin: boolean
|
|
||||||
canConnect: boolean
|
|
||||||
canWatch: boolean
|
|
||||||
canHost: boolean
|
|
||||||
canAccessClipboard: boolean
|
|
||||||
}) {
|
|
||||||
this.api.admin.membersCreate({ memberDataPayload })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public memberUpdate(
|
public get members(): MembersApi {
|
||||||
memberId: string,
|
return this.api.members
|
||||||
memberProfile: {
|
|
||||||
secret: string
|
|
||||||
name: string
|
|
||||||
isAdmin: boolean
|
|
||||||
canLogin: boolean
|
|
||||||
canConnect: boolean
|
|
||||||
canWatch: boolean
|
|
||||||
canHost: boolean
|
|
||||||
canAccessClipboard: boolean
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
this.api.admin.membersUpdate({ memberId, memberProfile })
|
|
||||||
}
|
|
||||||
|
|
||||||
public memberDelete(memberId: string) {
|
|
||||||
this.api.admin.membersDelete({ memberId })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor.
|
// TODO: Refactor.
|
||||||
|
Loading…
Reference in New Issue
Block a user