ozone-typescript-client
ozone-typescript-client
is a typescript module that manage connection and communication to ozone.
Interface
export interface OzoneClient extends StateMachine<ClientState> {
readonly config: ClientConfiguration
readonly authInfo?: AuthInfo
readonly lastFailedLogin?: Response<AuthInfo>
readonly isAuthenticated: boolean
readonly isConnected: boolean
start(): Promise<void>
readonly preFilters: InstalledFilter[]
readonly postFilters: InstalledFilter[]
updateWSURL(url: string): void
updateCredentials(ozoneCredentials: OzoneCredentials): void
stop(): Promise<void>
callForResponse<T>(request: Request): Promise<Response<T>>
call<T>(request: Request): Promise<T>
onMessage<M extends Message>(messageType: string, callBack: (message: M) => void): ListenerRegistration
onAnyMessage(callBack: (message: Message) => void): ListenerRegistration
send(message: Message): void
itemClient<T extends Item>(typeIdentifier: string): ItemClient<T>
insertSessionIdInURL(url: string): string
}
Usage
import { OzoneClient } from 'ozone-typescript-client'
import UserCredentials = OzoneClient.UserCredentials
import OzoneCredentials = OzoneClient.OzoneCredentials
import ClientConfiguration = OzoneClient.ClientConfiguration
import newOzoneClient = OzoneClient.newOzoneClient
let client: OzoneClient.OzoneClient
async function init() {
const credentials = new UserCredentials('ozoneUser', 'ozonePassword')
const config: ClientConfiguration = {
ozoneURL: `http://my.ozone.domain/ozone`,
ozoneCredentials: credentials
}
client = newOzoneClient(config)
await client.start()
}
Install
$ npm install --save ozone-typescript-client