index.d.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. * TSRPC Miniapp v3.4.16
  3. * -----------------------------------------
  4. * Copyright (c) King Wang.
  5. * MIT License
  6. * https://github.com/k8w/tsrpc-miniapp
  7. */
  8. import { BaseHttpClient } from 'tsrpc-base-client';
  9. import { BaseHttpClientOptions } from 'tsrpc-base-client';
  10. import { BaseServiceType } from 'tsrpc-proto';
  11. import { BaseWsClient } from 'tsrpc-base-client';
  12. import { BaseWsClientOptions } from 'tsrpc-base-client';
  13. import { ServiceProto } from 'tsrpc-proto';
  14. /**
  15. * Client for TSRPC HTTP Server.
  16. * It uses native http module of NodeJS.
  17. * @typeParam ServiceType - `ServiceType` from generated `proto.ts`
  18. */
  19. export declare class HttpClient<ServiceType extends BaseServiceType> extends BaseHttpClient<ServiceType> {
  20. readonly options: Readonly<HttpClientOptions>;
  21. constructor(proto: ServiceProto<ServiceType>, options?: Partial<HttpClientOptions>);
  22. }
  23. export declare interface HttpClientOptions extends BaseHttpClientOptions {
  24. /**
  25. * MiniApp API Object
  26. * @remarks
  27. * - Wechat: `wx`
  28. * - QQ MiniApp: `qq`
  29. * - ByteDance MiniApp: `tt`
  30. * @defaultValue `wx`
  31. */
  32. miniappObj: any;
  33. }
  34. /**
  35. * Client for TSRPC WebSocket Server.
  36. * @typeParam ServiceType - `ServiceType` from generated `proto.ts`
  37. */
  38. export declare class WsClient<ServiceType extends BaseServiceType> extends BaseWsClient<ServiceType> {
  39. readonly options: Readonly<WsClientOptions>;
  40. constructor(proto: ServiceProto<ServiceType>, options?: Partial<WsClientOptions>);
  41. }
  42. export declare interface WsClientOptions extends BaseWsClientOptions {
  43. /**
  44. * MiniApp API Object
  45. * Wechat: wx
  46. * QQ MiniApp: qq
  47. * ByteDance MiniApp: tt
  48. */
  49. miniappObj: any;
  50. /** Extra options to wx.connectSocket */
  51. connectSocketOptions?: object;
  52. }
  53. export * from "tsrpc-proto";
  54. export { }