Skip to content

Instantly share code, notes, and snippets.

@kunjee17
Last active November 20, 2017 05:04
Show Gist options
  • Save kunjee17/7cf9fa9de09c3653cdb0af98c9722801 to your computer and use it in GitHub Desktop.
Save kunjee17/7cf9fa9de09c3653cdb0af98c9722801 to your computer and use it in GitHub Desktop.
module rec Fable.Import.ServicestackClient
open System
open Fable.Core
open Fable.Import.JS
open Fable.Import.Browser
open Fable.PowerPack.Fetch
type [<AllowNullLiteral>] IExports =
abstract IEventSource: IEventSourceStaticStatic with get, set
abstract ServerEventsClient: ServerEventsClientStatic with get, set
abstract JsonServiceClient: JsonServiceClientStatic with get, set
type [<AllowNullLiteral>] IReturnVoid =
abstract createResponse: unit -> obj
type [<AllowNullLiteral>] IReturn<'T> =
abstract createResponse: unit -> 'T
type [<AllowNullLiteral>] ResponseStatus =
abstract errorCode: string with get, set
abstract message: string with get, set
abstract stackTrace: string with get, set
abstract errors: ResizeArray<ResponseError> with get, set
abstract meta: obj with get, set
type [<AllowNullLiteral>] ResponseError =
abstract errorCode: string with get, set
abstract fieldName: string with get, set
abstract message: string with get, set
abstract meta: obj with get, set
type [<AllowNullLiteral>] ErrorResponse =
abstract responseStatus: ResponseStatus with get, set
type [<AllowNullLiteral>] IResolver =
abstract tryResolve: Function: obj -> obj
type [<AllowNullLiteral>] NewInstanceResolver =
inherit IResolver
abstract tryResolve: ctor: ObjectConstructor -> obj
type [<AllowNullLiteral>] SingletonInstanceResolver =
inherit IResolver
abstract tryResolve: ctor: ObjectConstructor -> obj
type [<AllowNullLiteral>] ServerEventMessage =
abstract ``type``: U6<string, string, string, string, string, string> with get, set
abstract eventId: float with get, set
abstract channel: string with get, set
abstract data: string with get, set
abstract selector: string with get, set
abstract json: string with get, set
abstract op: string with get, set
abstract target: string with get, set
abstract cssSelector: string with get, set
abstract body: obj with get, set
abstract meta: obj with get, set
type [<AllowNullLiteral>] ServerEventCommand =
inherit ServerEventMessage
abstract userId: string with get, set
abstract displayName: string with get, set
abstract channels: string with get, set
abstract profileUrl: string with get, set
type [<AllowNullLiteral>] ServerEventConnect =
inherit ServerEventCommand
abstract id: string with get, set
abstract unRegisterUrl: string with get, set
abstract heartbeatUrl: string with get, set
abstract updateSubscriberUrl: string with get, set
abstract heartbeatIntervalMs: float with get, set
abstract idleTimeoutMs: float with get, set
type [<AllowNullLiteral>] ServerEventHeartbeat =
inherit ServerEventCommand
type [<AllowNullLiteral>] ServerEventJoin =
inherit ServerEventCommand
type [<AllowNullLiteral>] ServerEventLeave =
inherit ServerEventCommand
type [<AllowNullLiteral>] ServerEventUpdate =
inherit ServerEventCommand
type [<AllowNullLiteral>] IReconnectServerEventsOptions =
abstract url: string option with get, set
abstract onerror: (ResizeArray<obj> -> unit) option with get, set
abstract onmessage: (ResizeArray<obj> -> unit) option with get, set
abstract error: Error option with get, set
type [<RequireQualifiedAccess>] ReadyState =
| CONNECTING = 0
| OPEN = 1
| CLOSED = 2
type [<AllowNullLiteral>] IEventSourceStatic =
inherit EventTarget
abstract url: string with get, set
abstract withCredentials: bool with get, set
abstract CONNECTING: ReadyState with get, set
abstract OPEN: ReadyState with get, set
abstract CLOSED: ReadyState with get, set
abstract readyState: ReadyState with get, set
abstract onopen: Function with get, set
abstract onmessage: (IOnMessageEvent -> unit) with get, set
abstract onerror: Function with get, set
abstract close: (unit -> unit) with get, set
type [<AllowNullLiteral>] IEventSourceStaticStatic =
[<Emit "new $0($1...)">] abstract Create: url: string * ?eventSourceInitDict: IEventSourceInit -> IEventSourceStatic
type [<AllowNullLiteral>] IEventSourceInit =
abstract withCredentials: bool option with get, set
type [<AllowNullLiteral>] IOnMessageEvent =
abstract data: string with get, set
type [<AllowNullLiteral>] IEventSourceOptions =
abstract channels: string option with get, set
abstract handlers: obj option with get, set
abstract receivers: obj option with get, set
abstract onException: Function option with get, set
abstract onReconnect: Function option with get, set
abstract onTick: Function option with get, set
abstract resolver: IResolver option with get, set
abstract validate: (ServerEventMessage -> bool) option with get, set
abstract heartbeatUrl: string option with get, set
abstract unRegisterUrl: string option with get, set
abstract updateSubscriberUrl: string option with get, set
abstract heartbeatIntervalMs: float option with get, set
abstract heartbeat: float option with get, set
type [<AllowNullLiteral>] ServerEventsClient =
abstract channels: ResizeArray<string> with get, set
abstract options: IEventSourceOptions with get, set
abstract eventSource: IEventSourceStatic with get, set
abstract UnknownChannel: string with get, set
abstract eventStreamUri: string with get, set
abstract updateSubscriberUrl: string with get, set
abstract connectionInfo: ServerEventConnect with get, set
abstract serviceClient: JsonServiceClient with get, set
abstract stopped: bool with get, set
abstract resolver: IResolver with get, set
abstract listeners: obj with get, set
abstract EventSource: IEventSourceStatic with get, set
abstract withCredentials: bool with get, set
abstract onMessage: (IOnMessageEvent -> unit) with get, set
abstract onError: (obj -> unit) with get, set
abstract getEventSourceOptions: unit -> obj
abstract reconnectServerEvents: ?opt: IReconnectServerEventsOptions -> IEventSourceStatic
abstract start: unit -> ServerEventsClient
abstract stop: unit -> Promise<unit>
abstract invokeReceiver: r: obj * cmd: string * el: Element * request: ServerEventMessage * name: string -> unit
abstract hasConnected: unit -> bool
abstract registerHandler: name: string * fn: Function -> ServerEventsClient
abstract setResolver: resolver: IResolver -> ServerEventsClient
abstract registerReceiver: receiver: obj -> ServerEventsClient
abstract registerNamedReceiver: name: string * receiver: obj -> ServerEventsClient
abstract unregisterReceiver: ?name: string -> ServerEventsClient
abstract updateChannels: channels: ResizeArray<string> -> unit
abstract update: subscribe: U2<string, ResizeArray<string>> * unsubscribe: U2<string, ResizeArray<string>> -> unit
abstract addListener: eventName: string * handler: obj -> ServerEventsClient
abstract removeListener: eventName: string * handler: obj -> ServerEventsClient
abstract raiseEvent: eventName: string * msg: ServerEventMessage -> unit
abstract getConnectionInfo: unit -> ServerEventConnect
abstract getSubscriptionId: unit -> string
abstract updateSubscriber: request: UpdateEventSubscriber -> Promise<obj>
abstract subscribeToChannels: [<ParamArray>] channels: string -> Promise<unit>
abstract unsubscribeFromChannels: [<ParamArray>] channels: string -> Promise<unit>
abstract getChannelSubscribers: unit -> Promise<ResizeArray<ServerEventUser>>
abstract toServerEventUser: map: obj -> ServerEventUser
type [<AllowNullLiteral>] ServerEventsClientStatic =
[<Emit "new $0($1...)">] abstract Create: baseUrl: string * channels: ResizeArray<string> * ?options: IEventSourceOptions * ?eventSource: IEventSourceStatic -> ServerEventsClient
type [<AllowNullLiteral>] IReceiver =
abstract noSuchMethod: selector: string * message: obj -> obj
type [<AllowNullLiteral>] ServerEventReceiver =
inherit IReceiver
abstract client: ServerEventsClient with get, set
abstract request: ServerEventMessage with get, set
abstract noSuchMethod: selector: string * message: obj -> unit
type [<AllowNullLiteral>] UpdateEventSubscriber =
inherit IReturn<UpdateEventSubscriberResponse>
abstract id: string with get, set
abstract subscribeChannels: ResizeArray<string> with get, set
abstract unsubscribeChannels: ResizeArray<string> with get, set
abstract createResponse: unit -> UpdateEventSubscriberResponse
abstract getTypeName: unit -> string
type [<AllowNullLiteral>] UpdateEventSubscriberResponse =
abstract responseStatus: ResponseStatus with get, set
type [<AllowNullLiteral>] GetEventSubscribers =
inherit IReturn<ResizeArray<obj>>
abstract channels: ResizeArray<string> with get, set
abstract createResponse: unit -> ResizeArray<obj>
abstract getTypeName: unit -> string
type [<AllowNullLiteral>] ServerEventUser =
abstract userId: string with get, set
abstract displayName: string with get, set
abstract profileUrl: string with get, set
abstract channels: ResizeArray<string> with get, set
abstract meta: obj with get, set
type [<AllowNullLiteral>] HttpMethods =
abstract Get: string with get, set
abstract Post: string with get, set
abstract Put: string with get, set
abstract Delete: string with get, set
abstract Patch: string with get, set
abstract Head: string with get, set
abstract Options: string with get, set
abstract hasRequestBody: (string -> bool) with get, set
type [<AllowNullLiteral>] IRequestFilterOptions =
abstract url: string with get, set
type [<AllowNullLiteral>] Cookie =
abstract name: string with get, set
abstract value: string with get, set
abstract path: string with get, set
abstract domain: string option with get, set
abstract expires: DateTime option with get, set
abstract httpOnly: bool option with get, set
abstract secure: bool option with get, set
abstract sameSite: string option with get, set
type [<AllowNullLiteral>] GetAccessTokenResponse =
abstract accessToken: string with get, set
abstract responseStatus: ResponseStatus with get, set
type [<AllowNullLiteral>] JsonServiceClient =
abstract baseUrl: string with get, set
abstract replyBaseUrl: string with get, set
abstract oneWayBaseUrl: string with get, set
abstract mode: RequestMode with get, set
abstract credentials: RequestCredentials with get, set
abstract headers: Headers with get, set
abstract userName: string with get, set
abstract password: string with get, set
abstract bearerToken: string with get, set
abstract refreshToken: string with get, set
abstract refreshTokenUri: string with get, set
abstract requestFilter: (Request -> IRequestFilterOptions -> unit) with get, set
abstract responseFilter: (Response -> unit) with get, set
abstract exceptionFilter: (Response -> obj -> unit) with get, set
abstract onAuthenticationRequired: (unit -> Promise<obj>) with get, set
abstract manageCookies: bool with get, set
abstract cookies: obj with get, set
abstract toBase64: (string -> string) with get, set
abstract setCredentials: userName: string * password: string -> unit
abstract setBearerToken: token: string -> unit
abstract get: request: U2<IReturn<'T>, string> * ?args: obj -> Promise<'T>
abstract delete: request: U2<IReturn<'T>, string> * ?args: obj -> Promise<'T>
abstract post: request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract postToUrl: url: string * request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract put: request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract putToUrl: url: string * request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract patch: request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract patchToUrl: url: string * request: IReturn<'T> * ?args: obj -> Promise<'T>
abstract createUrlFromDto: ``method``: string * request: IReturn<'T> -> string
abstract toAbsoluteUrl: relativeOrAbsoluteUrl: string -> string
abstract createRequest: ``method``: obj * request: obj * ?args: obj * ?url: obj -> unit
abstract createResponse: res: obj * request: obj -> unit
abstract handleError: holdRes: obj * res: obj -> unit
abstract send: ``method``: string * request: obj option * ?args: obj * ?url: string -> Promise<'T>
abstract raiseError: res: Response * error: obj -> obj
type [<AllowNullLiteral>] JsonServiceClientStatic =
[<Emit "new $0($1...)">] abstract Create: baseUrl: string -> JsonServiceClient
let [<Global>] toCamelCase: (string -> string) = jsNative
let [<Global>] sanitize: (obj -> obj) = jsNative
let [<Global>] nameOf: (obj -> obj) = jsNative
let [<Global>] css: (U2<string, NodeListOf<Element>> -> string -> string -> unit) = jsNative
let [<Global>] splitOnFirst: (string -> string -> ResizeArray<string>) = jsNative
let [<Global>] splitOnLast: (string -> string -> ResizeArray<string>) = jsNative
let [<Global>] humanize: (obj -> obj) = jsNative
let [<Global>] queryString: (string -> obj) = jsNative
let [<Global>] combinePaths: (ResizeArray<string> -> string) = jsNative
let [<Global>] createPath: (string -> obj -> string) = jsNative
let [<Global>] createUrl: (string -> obj -> string) = jsNative
let [<Global>] appendQueryString: (string -> obj -> string) = jsNative
let [<Global>] bytesToBase64: (Uint8Array -> string) = jsNative
let [<Global>] stripQuotes: (string -> string) = jsNative
let [<Global>] tryDecode: (string -> string) = jsNative
let [<Global>] parseCookie: (string -> Cookie) = jsNative
let [<Global>] toDate: (string -> DateTime) = jsNative
let [<Global>] toDateFmt: (string -> string) = jsNative
let [<Global>] padInt: (float -> U2<string, float>) = jsNative
let [<Global>] dateFmt: (DateTime -> string) = jsNative
let [<Global>] dateFmtHM: (DateTime -> string) = jsNative
let [<Global>] timeFmt12: (DateTime -> string) = jsNative
module Fable.Import.Servicestack
open System
open System.Text.RegularExpressions
open Fable.Core
open Fable.Import.JS
open Fable.PowerPack.Fetch
open Fable.Import.Browser
type [<AllowNullLiteral>] IReturnVoid =
interface end
and [<AllowNullLiteral>] IReturn<'T> =
interface end
and [<AllowNullLiteral>] [<Import("*","ResponseStatus")>] ResponseStatus() =
member __.errorCode with get(): string = jsNative and set(v: string): unit = jsNative
member __.message with get(): string = jsNative and set(v: string): unit = jsNative
member __.stackTrace with get(): string = jsNative and set(v: string): unit = jsNative
member __.errors with get(): ResizeArray<ResponseError> = jsNative and set(v: ResizeArray<ResponseError>): unit = jsNative
member __.meta with get(): obj = jsNative and set(v: obj): unit = jsNative
and [<AllowNullLiteral>] [<Import("*","ResponseError")>] ResponseError() =
member __.errorCode with get(): string = jsNative and set(v: string): unit = jsNative
member __.fieldName with get(): string = jsNative and set(v: string): unit = jsNative
member __.message with get(): string = jsNative and set(v: string): unit = jsNative
member __.meta with get(): obj = jsNative and set(v: obj): unit = jsNative
and [<AllowNullLiteral>] [<Import("*","ErrorResponse")>] ErrorResponse() =
member __.responseStatus with get(): ResponseStatus = jsNative and set(v: ResponseStatus): unit = jsNative
and [<AllowNullLiteral>] IResolver =
abstract tryResolve: Function: obj -> obj
and [<AllowNullLiteral>] [<Import("*","NewInstanceResolver")>] NewInstanceResolver() =
interface IResolver with
member __.tryResolve(Function: obj): obj = jsNative
member __.tryResolve(ctor: ObjectConstructor): obj = jsNative
and [<AllowNullLiteral>] [<Import("*","SingletonInstanceResolver")>] SingletonInstanceResolver() =
interface IResolver with
member __.tryResolve(Function: obj): obj = jsNative
member __.tryResolve(ctor: ObjectConstructor): obj = jsNative
and [<AllowNullLiteral>] ServerEventMessage =
abstract ``type``: (* TODO StringEnum ServerEventConnect | ServerEventHeartbeat | ServerEventJoin | ServerEventLeave | ServerEventUpdate | ServerEventMessage *) string with get, set
abstract eventId: float with get, set
abstract channel: string with get, set
abstract data: string with get, set
abstract selector: string with get, set
abstract json: string with get, set
abstract op: string with get, set
abstract target: string with get, set
abstract cssSelector: string with get, set
abstract body: obj with get, set
abstract meta: obj with get, set
and [<AllowNullLiteral>] ServerEventCommand =
inherit ServerEventMessage
abstract userId: string with get, set
abstract displayName: string with get, set
abstract channels: string with get, set
abstract profileUrl: string with get, set
and [<AllowNullLiteral>] ServerEventConnect =
inherit ServerEventCommand
abstract id: string with get, set
abstract unRegisterUrl: string with get, set
abstract heartbeatUrl: string with get, set
abstract updateSubscriberUrl: string with get, set
abstract heartbeatIntervalMs: float with get, set
abstract idleTimeoutMs: float with get, set
and [<AllowNullLiteral>] ServerEventHeartbeat =
inherit ServerEventCommand
and [<AllowNullLiteral>] ServerEventJoin =
inherit ServerEventCommand
and [<AllowNullLiteral>] ServerEventLeave =
inherit ServerEventCommand
and [<AllowNullLiteral>] ServerEventUpdate =
inherit ServerEventCommand
and [<AllowNullLiteral>] IReconnectServerEventsOptions =
abstract url: string option with get, set
abstract onerror: Func<obj, unit> option with get, set
abstract onmessage: Func<obj, unit> option with get, set
abstract error: Error option with get, set
and ReadyState =
| CONNECTING = 0
| OPEN = 1
| CLOSED = 2
and [<AllowNullLiteral>] IEventSourceStatic =
inherit EventTarget
abstract url: string with get, set
abstract withCredentials: bool with get, set
abstract CONNECTING: ReadyState with get, set
abstract OPEN: ReadyState with get, set
abstract CLOSED: ReadyState with get, set
abstract readyState: ReadyState with get, set
abstract onopen: Function with get, set
abstract onmessage: Func<IOnMessageEvent, unit> with get, set
abstract onerror: Function with get, set
abstract close: Func<unit, unit> with get, set
[<Emit("new $0($1...)")>] abstract Create: url: string * ?eventSourceInitDict: IEventSourceInit -> IEventSourceStatic
and [<AllowNullLiteral>] IEventSourceInit =
abstract withCredentials: bool option with get, set
and [<AllowNullLiteral>] IOnMessageEvent =
abstract data: string with get, set
and [<AllowNullLiteral>] IEventSourceOptions =
abstract channels: string option with get, set
abstract handlers: obj option with get, set
abstract receivers: obj option with get, set
abstract onException: Function option with get, set
abstract onReconnect: Function option with get, set
abstract onTick: Function option with get, set
abstract resolver: IResolver option with get, set
abstract validate: Func<ServerEventMessage, bool> option with get, set
abstract heartbeatUrl: string option with get, set
abstract unRegisterUrl: string option with get, set
abstract updateSubscriberUrl: string option with get, set
abstract heartbeatIntervalMs: float option with get, set
abstract heartbeat: float option with get, set
and [<AllowNullLiteral>] [<Import("*","ServerEventsClient")>] ServerEventsClient(baseUrl: string, channels: ResizeArray<string>, ?options: IEventSourceOptions, ?eventSource: IEventSourceStatic) =
member __.channels with get(): ResizeArray<string> = jsNative and set(v: ResizeArray<string>): unit = jsNative
member __.options with get(): IEventSourceOptions = jsNative and set(v: IEventSourceOptions): unit = jsNative
member __.eventSource with get(): IEventSourceStatic = jsNative and set(v: IEventSourceStatic): unit = jsNative
member __.UnknownChannel with get(): string = jsNative and set(v: string): unit = jsNative
member __.eventStreamUri with get(): string = jsNative and set(v: string): unit = jsNative
member __.updateSubscriberUrl with get(): string = jsNative and set(v: string): unit = jsNative
member __.connectionInfo with get(): ServerEventConnect = jsNative and set(v: ServerEventConnect): unit = jsNative
member __.serviceClient with get(): JsonServiceClient = jsNative and set(v: JsonServiceClient): unit = jsNative
member __.stopped with get(): bool = jsNative and set(v: bool): unit = jsNative
member __.resolver with get(): IResolver = jsNative and set(v: IResolver): unit = jsNative
member __.listeners with get(): obj = jsNative and set(v: obj): unit = jsNative
member __.EventSource with get(): IEventSourceStatic = jsNative and set(v: IEventSourceStatic): unit = jsNative
member __.withCredentials with get(): bool = jsNative and set(v: bool): unit = jsNative
member __.onMessage with get(): Func<IOnMessageEvent, unit> = jsNative and set(v: Func<IOnMessageEvent, unit>): unit = jsNative
member __.onError with get(): Func<obj, unit> = jsNative and set(v: Func<obj, unit>): unit = jsNative
member __.getEventSourceOptions(): obj = jsNative
member __.reconnectServerEvents(?opt: IReconnectServerEventsOptions): IEventSourceStatic = jsNative
member __.start(): obj = jsNative
member __.stop(): Promise<unit> = jsNative
member __.invokeReceiver(r: obj, cmd: string, el: Element, request: ServerEventMessage, name: string): unit = jsNative
member __.hasConnected(): bool = jsNative
member __.registerHandler(name: string, fn: Function): obj = jsNative
member __.setResolver(resolver: IResolver): obj = jsNative
member __.registerReceiver(receiver: obj): obj = jsNative
member __.registerNamedReceiver(name: string, receiver: obj): obj = jsNative
member __.unregisterReceiver(?name: string): obj = jsNative
member __.updateChannels(channels: ResizeArray<string>): unit = jsNative
member __.update(subscribe: U2<string, ResizeArray<string>>, unsubscribe: U2<string, ResizeArray<string>>): unit = jsNative
member __.addListener(eventName: string, handler: Func<ServerEventMessage, unit>): obj = jsNative
member __.removeListener(eventName: string, handler: Func<ServerEventMessage, unit>): obj = jsNative
member __.raiseEvent(eventName: string, msg: ServerEventMessage): unit = jsNative
member __.getConnectionInfo(): ServerEventConnect = jsNative
member __.getSubscriptionId(): string = jsNative
member __.updateSubscriber(request: UpdateEventSubscriber): Promise<obj> = jsNative
member __.subscribeToChannels([<ParamArray>] channels: string[]): Promise<unit> = jsNative
member __.unsubscribeFromChannels([<ParamArray>] channels: string[]): Promise<unit> = jsNative
member __.getChannelSubscribers(): Promise<ResizeArray<ServerEventUser>> = jsNative
member __.toServerEventUser(map: obj): ServerEventUser = jsNative
and [<AllowNullLiteral>] IReceiver =
abstract noSuchMethod: selector: string * message: obj -> obj
and [<AllowNullLiteral>] [<Import("*","ServerEventReceiver")>] ServerEventReceiver() =
interface IReceiver with
member __.noSuchMethod(selector: string, message: obj): obj = jsNative
member __.client with get(): ServerEventsClient = jsNative and set(v: ServerEventsClient): unit = jsNative
member __.request with get(): ServerEventMessage = jsNative and set(v: ServerEventMessage): unit = jsNative
and [<AllowNullLiteral>] [<Import("*","UpdateEventSubscriber")>] UpdateEventSubscriber() =
interface IReturn<UpdateEventSubscriberResponse>
member __.id with get(): string = jsNative and set(v: string): unit = jsNative
member __.subscribeChannels with get(): ResizeArray<string> = jsNative and set(v: ResizeArray<string>): unit = jsNative
member __.unsubscribeChannels with get(): ResizeArray<string> = jsNative and set(v: ResizeArray<string>): unit = jsNative
member __.getTypeName(): string = jsNative
and [<AllowNullLiteral>] [<Import("*","UpdateEventSubscriberResponse")>] UpdateEventSubscriberResponse() =
member __.responseStatus with get(): ResponseStatus = jsNative and set(v: ResponseStatus): unit = jsNative
and [<AllowNullLiteral>] [<Import("*","GetEventSubscribers")>] GetEventSubscribers() =
interface IReturn<obj []>
member __.channels with get(): ResizeArray<string> = jsNative and set(v: ResizeArray<string>): unit = jsNative
member __.getTypeName(): string = jsNative
and [<AllowNullLiteral>] [<Import("*","ServerEventUser")>] ServerEventUser() =
member __.userId with get(): string = jsNative and set(v: string): unit = jsNative
member __.displayName with get(): string = jsNative and set(v: string): unit = jsNative
member __.profileUrl with get(): string = jsNative and set(v: string): unit = jsNative
member __.channels with get(): ResizeArray<string> = jsNative and set(v: ResizeArray<string>): unit = jsNative
member __.meta with get(): obj = jsNative and set(v: obj): unit = jsNative
and [<AllowNullLiteral>] [<Import("*","HttpMethods")>] HttpMethods() =
member __.Get with get(): string = jsNative and set(v: string): unit = jsNative
member __.Post with get(): string = jsNative and set(v: string): unit = jsNative
member __.Put with get(): string = jsNative and set(v: string): unit = jsNative
member __.Delete with get(): string = jsNative and set(v: string): unit = jsNative
member __.Patch with get(): string = jsNative and set(v: string): unit = jsNative
member __.Head with get(): string = jsNative and set(v: string): unit = jsNative
member __.Options with get(): string = jsNative and set(v: string): unit = jsNative
member __.hasRequestBody with get(): Func<string, bool> = jsNative and set(v: Func<string, bool>): unit = jsNative
and [<AllowNullLiteral>] IRequestFilterOptions =
abstract url: string with get, set
and [<AllowNullLiteral>] Cookie =
abstract name: string with get, set
abstract value: string with get, set
abstract path: string with get, set
abstract domain: string option with get, set
abstract expires: DateTime option with get, set
abstract httpOnly: bool option with get, set
abstract secure: bool option with get, set
abstract sameSite: string option with get, set
and [<AllowNullLiteral>] [<Import("*","GetAccessTokenResponse")>] GetAccessTokenResponse() =
member __.accessToken with get(): string = jsNative and set(v: string): unit = jsNative
member __.responseStatus with get(): ResponseStatus = jsNative and set(v: ResponseStatus): unit = jsNative
and [<AllowNullLiteral>] [<Import("JsonServiceClient","servicestack-client")>] JsonServiceClient(baseUrl: string) =
member __.baseUrl with get(): string = jsNative and set(v: string): unit = jsNative
member __.replyBaseUrl with get(): string = jsNative and set(v: string): unit = jsNative
member __.oneWayBaseUrl with get(): string = jsNative and set(v: string): unit = jsNative
member __.mode with get(): RequestMode = jsNative and set(v: RequestMode): unit = jsNative
member __.credentials with get(): RequestCredentials = jsNative and set(v: RequestCredentials): unit = jsNative
member __.headers with get(): Headers = jsNative and set(v: Headers): unit = jsNative
member __.userName with get(): string = jsNative and set(v: string): unit = jsNative
member __.password with get(): string = jsNative and set(v: string): unit = jsNative
member __.bearerToken with get(): string = jsNative and set(v: string): unit = jsNative
member __.refreshToken with get(): string = jsNative and set(v: string): unit = jsNative
member __.refreshTokenUri with get(): string = jsNative and set(v: string): unit = jsNative
member __.requestFilter with get(): Func<Request, IRequestFilterOptions, unit> = jsNative and set(v: Func<Request, IRequestFilterOptions, unit>): unit = jsNative
member __.responseFilter with get(): Func<Response, unit> = jsNative and set(v: Func<Response, unit>): unit = jsNative
member __.exceptionFilter with get(): Func<Response, obj, unit> = jsNative and set(v: Func<Response, obj, unit>): unit = jsNative
member __.onAuthenticationRequired with get(): Func<unit, Promise<obj>> = jsNative and set(v: Func<unit, Promise<obj>>): unit = jsNative
member __.manageCookies with get(): bool = jsNative and set(v: bool): unit = jsNative
member __.cookies with get(): obj = jsNative and set(v: obj): unit = jsNative
member __.toBase64 with get(): Func<string, string> = jsNative and set(v: Func<string, string>): unit = jsNative
member __.setCredentials(userName: string, password: string): unit = jsNative
member __.setBearerToken(token: string): unit = jsNative
member __.get(request: U2<IReturn<'T>, string>, ?args: obj): Promise<'T> = jsNative
member __.delete(request: U2<IReturn<'T>, string>, ?args: obj): Promise<'T> = jsNative
member __.post(request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.postToUrl(url: string, request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.put(request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.putToUrl(url: string, request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.patch(request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.patchToUrl(url: string, request: IReturn<'T>, ?args: obj): Promise<'T> = jsNative
member __.createUrlFromDto(``method``: string, request: IReturn<'T>): string = jsNative
member __.toAbsoluteUrl(relativeOrAbsoluteUrl: string): string = jsNative
member __.createRequest(``method``: obj, request: obj, ?args: obj, ?url: obj): obj = jsNative
member __.createResponse(res: obj, request: obj): obj = jsNative
member __.handleError(holdRes: obj, res: obj): obj = jsNative
member __.send(``method``: string, request: U2<obj, obj>, ?args: obj, ?url: string): Promise<'T> = jsNative
member __.raiseError(res: Response, error: obj): obj = jsNative
type [<Erase>]Globals =
[<Global>] static member toCamelCase with get(): Func<string, string> = jsNative and set(v: Func<string, string>): unit = jsNative
[<Global>] static member sanitize with get(): Func<obj, obj> = jsNative and set(v: Func<obj, obj>): unit = jsNative
[<Global>] static member nameOf with get(): Func<obj, obj> = jsNative and set(v: Func<obj, obj>): unit = jsNative
[<Global>] static member css with get(): Func<U2<string, NodeListOf<Element>>, string, string, unit> = jsNative and set(v: Func<U2<string, NodeListOf<Element>>, string, string, unit>): unit = jsNative
[<Global>] static member splitOnFirst with get(): Func<string, string, ResizeArray<string>> = jsNative and set(v: Func<string, string, ResizeArray<string>>): unit = jsNative
[<Global>] static member splitOnLast with get(): Func<string, string, ResizeArray<string>> = jsNative and set(v: Func<string, string, ResizeArray<string>>): unit = jsNative
[<Global>] static member humanize with get(): Func<obj, obj> = jsNative and set(v: Func<obj, obj>): unit = jsNative
[<Global>] static member queryString with get(): Func<string, obj> = jsNative and set(v: Func<string, obj>): unit = jsNative
[<Global>] static member combinePaths with get(): Func<obj, string> = jsNative and set(v: Func<obj, string>): unit = jsNative
[<Global>] static member createPath with get(): Func<string, obj, string> = jsNative and set(v: Func<string, obj, string>): unit = jsNative
[<Global>] static member createUrl with get(): Func<string, obj, string> = jsNative and set(v: Func<string, obj, string>): unit = jsNative
[<Global>] static member appendQueryString with get(): Func<string, obj, string> = jsNative and set(v: Func<string, obj, string>): unit = jsNative
[<Global>] static member bytesToBase64 with get(): Func<Uint8Array, string> = jsNative and set(v: Func<Uint8Array, string>): unit = jsNative
[<Global>] static member stripQuotes with get(): Func<string, string> = jsNative and set(v: Func<string, string>): unit = jsNative
[<Global>] static member tryDecode with get(): Func<string, string> = jsNative and set(v: Func<string, string>): unit = jsNative
[<Global>] static member parseCookie with get(): Func<string, Cookie> = jsNative and set(v: Func<string, Cookie>): unit = jsNative
[<Global>] static member toDate with get(): Func<string, DateTime> = jsNative and set(v: Func<string, DateTime>): unit = jsNative
[<Global>] static member toDateFmt with get(): Func<string, string> = jsNative and set(v: Func<string, string>): unit = jsNative
[<Global>] static member padInt with get(): Func<float, U2<string, float>> = jsNative and set(v: Func<float, U2<string, float>>): unit = jsNative
[<Global>] static member dateFmt with get(): Func<DateTime, string> = jsNative and set(v: Func<DateTime, string>): unit = jsNative
[<Global>] static member dateFmtHM with get(): Func<DateTime, string> = jsNative and set(v: Func<DateTime, string>): unit = jsNative
[<Global>] static member timeFmt12 with get(): Func<DateTime, string> = jsNative and set(v: Func<DateTime, string>): unit = jsNative
import 'fetch-everywhere';
export interface IReturnVoid {
createResponse(): any;
}
export interface IReturn<T> {
createResponse(): T;
}
export declare class ResponseStatus {
errorCode: string;
message: string;
stackTrace: string;
errors: ResponseError[];
meta: {
[index: string]: string;
};
}
export declare class ResponseError {
errorCode: string;
fieldName: string;
message: string;
meta: {
[index: string]: string;
};
}
export declare class ErrorResponse {
responseStatus: ResponseStatus;
}
export interface IResolver {
tryResolve(Function: any): any;
}
export declare class NewInstanceResolver implements IResolver {
tryResolve(ctor: ObjectConstructor): any;
}
export declare class SingletonInstanceResolver implements IResolver {
tryResolve(ctor: ObjectConstructor): any;
}
export interface ServerEventMessage {
type: "ServerEventConnect" | "ServerEventHeartbeat" | "ServerEventJoin" | "ServerEventLeave" | "ServerEventUpdate" | "ServerEventMessage";
eventId: number;
channel: string;
data: string;
selector: string;
json: string;
op: string;
target: string;
cssSelector: string;
body: any;
meta: {
[index: string]: string;
};
}
export interface ServerEventCommand extends ServerEventMessage {
userId: string;
displayName: string;
channels: string;
profileUrl: string;
}
export interface ServerEventConnect extends ServerEventCommand {
id: string;
unRegisterUrl: string;
heartbeatUrl: string;
updateSubscriberUrl: string;
heartbeatIntervalMs: number;
idleTimeoutMs: number;
}
export interface ServerEventHeartbeat extends ServerEventCommand {
}
export interface ServerEventJoin extends ServerEventCommand {
}
export interface ServerEventLeave extends ServerEventCommand {
}
export interface ServerEventUpdate extends ServerEventCommand {
}
export interface IReconnectServerEventsOptions {
url?: string;
onerror?: (...args: any[]) => void;
onmessage?: (...args: any[]) => void;
error?: Error;
}
/**
* EventSource
*/
export declare enum ReadyState {
CONNECTING = 0,
OPEN = 1,
CLOSED = 2,
}
export interface IEventSourceStatic extends EventTarget {
new (url: string, eventSourceInitDict?: IEventSourceInit): IEventSourceStatic;
url: string;
withCredentials: boolean;
CONNECTING: ReadyState;
OPEN: ReadyState;
CLOSED: ReadyState;
readyState: ReadyState;
onopen: Function;
onmessage: (event: IOnMessageEvent) => void;
onerror: Function;
close: () => void;
}
export interface IEventSourceInit {
withCredentials?: boolean;
}
export interface IOnMessageEvent {
data: string;
}
export interface IEventSourceOptions {
channels?: string;
handlers?: any;
receivers?: any;
onException?: Function;
onReconnect?: Function;
onTick?: Function;
resolver?: IResolver;
validate?: (request: ServerEventMessage) => boolean;
heartbeatUrl?: string;
unRegisterUrl?: string;
updateSubscriberUrl?: string;
heartbeatIntervalMs?: number;
heartbeat?: number;
}
export declare class ServerEventsClient {
channels: string[];
options: IEventSourceOptions;
eventSource: IEventSourceStatic;
static UnknownChannel: string;
eventStreamUri: string;
updateSubscriberUrl: string;
connectionInfo: ServerEventConnect;
serviceClient: JsonServiceClient;
stopped: boolean;
resolver: IResolver;
listeners: {
[index: string]: ((e: ServerEventMessage) => void)[];
};
EventSource: IEventSourceStatic;
withCredentials: boolean;
constructor(baseUrl: string, channels: string[], options?: IEventSourceOptions, eventSource?: IEventSourceStatic);
onMessage: (e: IOnMessageEvent) => void;
onError: (error?: any) => void;
getEventSourceOptions(): {
withCredentials: boolean;
};
reconnectServerEvents(opt?: IReconnectServerEventsOptions): IEventSourceStatic;
start(): this;
stop(): Promise<void>;
invokeReceiver(r: any, cmd: string, el: Element, request: ServerEventMessage, name: string): void;
hasConnected(): boolean;
registerHandler(name: string, fn: Function): this;
setResolver(resolver: IResolver): this;
registerReceiver(receiver: any): this;
registerNamedReceiver(name: string, receiver: any): this;
unregisterReceiver(name?: string): this;
updateChannels(channels: string[]): void;
update(subscribe: string | string[], unsubscribe: string | string[]): void;
addListener(eventName: string, handler: ((e: ServerEventMessage) => void)): this;
removeListener(eventName: string, handler: ((e: ServerEventMessage) => void)): this;
raiseEvent(eventName: string, msg: ServerEventMessage): void;
getConnectionInfo(): ServerEventConnect;
getSubscriptionId(): string;
updateSubscriber(request: UpdateEventSubscriber): Promise<any>;
subscribeToChannels(...channels: string[]): Promise<void>;
unsubscribeFromChannels(...channels: string[]): Promise<void>;
getChannelSubscribers(): Promise<ServerEventUser[]>;
toServerEventUser(map: {
[id: string]: string;
}): ServerEventUser;
}
export interface IReceiver {
noSuchMethod(selector: string, message: any): any;
}
export declare class ServerEventReceiver implements IReceiver {
client: ServerEventsClient;
request: ServerEventMessage;
noSuchMethod(selector: string, message: any): void;
}
export declare class UpdateEventSubscriber implements IReturn<UpdateEventSubscriberResponse> {
id: string;
subscribeChannels: string[];
unsubscribeChannels: string[];
createResponse(): UpdateEventSubscriberResponse;
getTypeName(): string;
}
export declare class UpdateEventSubscriberResponse {
responseStatus: ResponseStatus;
}
export declare class GetEventSubscribers implements IReturn<any[]> {
channels: string[];
createResponse(): any[];
getTypeName(): string;
}
export declare class ServerEventUser {
userId: string;
displayName: string;
profileUrl: string;
channels: string[];
meta: {
[index: string]: string;
};
}
export declare class HttpMethods {
static Get: string;
static Post: string;
static Put: string;
static Delete: string;
static Patch: string;
static Head: string;
static Options: string;
static hasRequestBody: (method: string) => boolean;
}
export interface IRequestFilterOptions {
url: string;
}
export interface Cookie {
name: string;
value: string;
path: string;
domain?: string;
expires?: Date;
httpOnly?: boolean;
secure?: boolean;
sameSite?: string;
}
export declare class GetAccessTokenResponse {
accessToken: string;
responseStatus: ResponseStatus;
}
export declare class JsonServiceClient {
baseUrl: string;
replyBaseUrl: string;
oneWayBaseUrl: string;
mode: RequestMode;
credentials: RequestCredentials;
headers: Headers;
userName: string;
password: string;
bearerToken: string;
refreshToken: string;
refreshTokenUri: string;
requestFilter: (req: Request, options?: IRequestFilterOptions) => void;
responseFilter: (res: Response) => void;
exceptionFilter: (res: Response, error: any) => void;
onAuthenticationRequired: () => Promise<any>;
manageCookies: boolean;
cookies: {
[index: string]: Cookie;
};
static toBase64: (rawString: string) => string;
constructor(baseUrl: string);
setCredentials(userName: string, password: string): void;
setBearerToken(token: string): void;
get<T>(request: IReturn<T> | string, args?: any): Promise<T>;
delete<T>(request: IReturn<T> | string, args?: any): Promise<T>;
post<T>(request: IReturn<T>, args?: any): Promise<T>;
postToUrl<T>(url: string, request: IReturn<T>, args?: any): Promise<T>;
put<T>(request: IReturn<T>, args?: any): Promise<T>;
putToUrl<T>(url: string, request: IReturn<T>, args?: any): Promise<T>;
patch<T>(request: IReturn<T>, args?: any): Promise<T>;
patchToUrl<T>(url: string, request: IReturn<T>, args?: any): Promise<T>;
createUrlFromDto<T>(method: string, request: IReturn<T>): string;
toAbsoluteUrl(relativeOrAbsoluteUrl: string): string;
private createRequest(method, request, args?, url?);
private createResponse<T>(res, request);
private handleError(holdRes, res);
send<T>(method: string, request: any | null, args?: any, url?: string): Promise<T>;
raiseError(res: Response, error: any): any;
}
export declare const toCamelCase: (key: string) => string;
export declare const sanitize: (status: any) => any;
export declare const nameOf: (o: any) => any;
export declare const css: (selector: string | NodeListOf<Element>, name: string, value: string) => void;
export declare const splitOnFirst: (s: string, c: string) => string[];
export declare const splitOnLast: (s: string, c: string) => string[];
export declare const humanize: (s: any) => any;
export declare const queryString: (url: string) => any;
export declare const combinePaths: (...paths: string[]) => string;
export declare const createPath: (route: string, args: any) => string;
export declare const createUrl: (route: string, args: any) => string;
export declare const appendQueryString: (url: string, args: any) => string;
export declare const bytesToBase64: (aBytes: Uint8Array) => string;
export declare const stripQuotes: (s: string) => string;
export declare const tryDecode: (s: string) => string;
export declare const parseCookie: (setCookie: string) => Cookie;
export declare const toDate: (s: string) => Date;
export declare const toDateFmt: (s: string) => string;
export declare const padInt: (n: number) => string | number;
export declare const dateFmt: (d?: Date) => string;
export declare const dateFmtHM: (d?: Date) => string;
export declare const timeFmt12: (d?: Date) => string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment