@juzi/wechaty-grpc 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cjs/out/wechaty/puppet/message_pb.d.ts +40 -0
  2. package/dist/cjs/out/wechaty/puppet/message_pb.js +304 -0
  3. package/dist/cjs/out/wechaty/puppet.openapi.yaml +25 -1
  4. package/dist/cjs/out/wechaty/puppet.swagger.json +39 -1
  5. package/dist/cjs/out/wechaty/puppet_grpc_pb.d.ts +17 -0
  6. package/dist/cjs/out/wechaty/puppet_grpc_pb.js +33 -0
  7. package/dist/cjs/out/wechaty/puppet_pb_service.d.ts +19 -0
  8. package/dist/cjs/out/wechaty/puppet_pb_service.js +40 -0
  9. package/dist/cjs/proto/wechaty/puppet/message.proto +7 -0
  10. package/dist/cjs/proto/wechaty/puppet.proto +7 -0
  11. package/dist/cjs/src/package-json.js +1 -1
  12. package/dist/cjs/tests/puppet-server-impl.d.ts.map +1 -1
  13. package/dist/cjs/tests/puppet-server-impl.js +5 -0
  14. package/dist/cjs/tests/puppet-server-impl.js.map +1 -1
  15. package/dist/esm/out/wechaty/puppet/message_pb.d.ts +40 -0
  16. package/dist/esm/out/wechaty/puppet/message_pb.js +304 -0
  17. package/dist/esm/out/wechaty/puppet.openapi.yaml +25 -1
  18. package/dist/esm/out/wechaty/puppet.swagger.json +39 -1
  19. package/dist/esm/out/wechaty/puppet_grpc_pb.d.ts +17 -0
  20. package/dist/esm/out/wechaty/puppet_grpc_pb.js +33 -0
  21. package/dist/esm/out/wechaty/puppet_pb_service.d.ts +19 -0
  22. package/dist/esm/out/wechaty/puppet_pb_service.js +40 -0
  23. package/dist/esm/proto/wechaty/puppet/message.proto +7 -0
  24. package/dist/esm/proto/wechaty/puppet.proto +7 -0
  25. package/dist/esm/src/package-json.js +1 -1
  26. package/dist/esm/tests/puppet-server-impl.d.ts.map +1 -1
  27. package/dist/esm/tests/puppet-server-impl.js +5 -0
  28. package/dist/esm/tests/puppet-server-impl.js.map +1 -1
  29. package/out/wechaty/puppet/message_pb.d.ts +40 -0
  30. package/out/wechaty/puppet/message_pb.js +304 -0
  31. package/out/wechaty/puppet.openapi.yaml +25 -1
  32. package/out/wechaty/puppet.swagger.json +39 -1
  33. package/out/wechaty/puppet_grpc_pb.d.ts +17 -0
  34. package/out/wechaty/puppet_grpc_pb.js +33 -0
  35. package/out/wechaty/puppet_pb_service.d.ts +19 -0
  36. package/out/wechaty/puppet_pb_service.js +40 -0
  37. package/package.json +1 -1
  38. package/src/package-json.ts +1 -1
@@ -64,6 +64,7 @@ interface IPuppetService extends grpc.ServiceDefinition<grpc.UntypedServiceImple
64
64
  messageSendUrl: IPuppetService_IMessageSendUrl;
65
65
  messageSendLocation: IPuppetService_IMessageSendLocation;
66
66
  messageSendChannel: IPuppetService_IMessageSendChannel;
67
+ messagePreview: IPuppetService_IMessagePreview;
67
68
  roomPayload: IPuppetService_IRoomPayload;
68
69
  roomList: IPuppetService_IRoomList;
69
70
  roomAdd: IPuppetService_IRoomAdd;
@@ -473,6 +474,15 @@ interface IPuppetService_IMessageSendChannel extends grpc.MethodDefinition<wecha
473
474
  responseSerialize: grpc.serialize<wechaty_puppet_message_pb.MessageSendChannelResponse>;
474
475
  responseDeserialize: grpc.deserialize<wechaty_puppet_message_pb.MessageSendChannelResponse>;
475
476
  }
477
+ interface IPuppetService_IMessagePreview extends grpc.MethodDefinition<wechaty_puppet_message_pb.MessagePreviewRequest, wechaty_puppet_message_pb.MessagePreviewResponse> {
478
+ path: "/wechaty.Puppet/MessagePreview";
479
+ requestStream: false;
480
+ responseStream: false;
481
+ requestSerialize: grpc.serialize<wechaty_puppet_message_pb.MessagePreviewRequest>;
482
+ requestDeserialize: grpc.deserialize<wechaty_puppet_message_pb.MessagePreviewRequest>;
483
+ responseSerialize: grpc.serialize<wechaty_puppet_message_pb.MessagePreviewResponse>;
484
+ responseDeserialize: grpc.deserialize<wechaty_puppet_message_pb.MessagePreviewResponse>;
485
+ }
476
486
  interface IPuppetService_IRoomPayload extends grpc.MethodDefinition<wechaty_puppet_room_pb.RoomPayloadRequest, wechaty_puppet_room_pb.RoomPayloadResponse> {
477
487
  path: "/wechaty.Puppet/RoomPayload";
478
488
  requestStream: false;
@@ -700,6 +710,7 @@ export interface IPuppetServer extends grpc.UntypedServiceImplementation {
700
710
  messageSendUrl: grpc.handleUnaryCall<wechaty_puppet_message_pb.MessageSendUrlRequest, wechaty_puppet_message_pb.MessageSendUrlResponse>;
701
711
  messageSendLocation: grpc.handleUnaryCall<wechaty_puppet_message_pb.MessageSendLocationRequest, wechaty_puppet_message_pb.MessageSendLocationResponse>;
702
712
  messageSendChannel: grpc.handleUnaryCall<wechaty_puppet_message_pb.MessageSendChannelRequest, wechaty_puppet_message_pb.MessageSendChannelResponse>;
713
+ messagePreview: grpc.handleUnaryCall<wechaty_puppet_message_pb.MessagePreviewRequest, wechaty_puppet_message_pb.MessagePreviewResponse>;
703
714
  roomPayload: grpc.handleUnaryCall<wechaty_puppet_room_pb.RoomPayloadRequest, wechaty_puppet_room_pb.RoomPayloadResponse>;
704
715
  roomList: grpc.handleUnaryCall<wechaty_puppet_room_pb.RoomListRequest, wechaty_puppet_room_pb.RoomListResponse>;
705
716
  roomAdd: grpc.handleUnaryCall<wechaty_puppet_room_pb.RoomAddRequest, wechaty_puppet_room_pb.RoomAddResponse>;
@@ -850,6 +861,9 @@ export interface IPuppetClient {
850
861
  messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
851
862
  messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
852
863
  messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
864
+ messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
865
+ messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
866
+ messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
853
867
  roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
854
868
  roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
855
869
  roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
@@ -1041,6 +1055,9 @@ export class PuppetClient extends grpc.Client implements IPuppetClient {
1041
1055
  public messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
1042
1056
  public messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
1043
1057
  public messageSendChannel(request: wechaty_puppet_message_pb.MessageSendChannelRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessageSendChannelResponse) => void): grpc.ClientUnaryCall;
1058
+ public messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
1059
+ public messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
1060
+ public messagePreview(request: wechaty_puppet_message_pb.MessagePreviewRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_message_pb.MessagePreviewResponse) => void): grpc.ClientUnaryCall;
1044
1061
  public roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
1045
1062
  public roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
1046
1063
  public roomPayload(request: wechaty_puppet_room_pb.RoomPayloadRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: wechaty_puppet_room_pb.RoomPayloadResponse) => void): grpc.ClientUnaryCall;
@@ -689,6 +689,28 @@ function deserialize_wechaty_puppet_MessagePayloadResponse(buffer_arg) {
689
689
  return wechaty_puppet_message_pb.MessagePayloadResponse.deserializeBinary(new Uint8Array(buffer_arg));
690
690
  }
691
691
 
692
+ function serialize_wechaty_puppet_MessagePreviewRequest(arg) {
693
+ if (!(arg instanceof wechaty_puppet_message_pb.MessagePreviewRequest)) {
694
+ throw new Error('Expected argument of type wechaty.puppet.MessagePreviewRequest');
695
+ }
696
+ return Buffer.from(arg.serializeBinary());
697
+ }
698
+
699
+ function deserialize_wechaty_puppet_MessagePreviewRequest(buffer_arg) {
700
+ return wechaty_puppet_message_pb.MessagePreviewRequest.deserializeBinary(new Uint8Array(buffer_arg));
701
+ }
702
+
703
+ function serialize_wechaty_puppet_MessagePreviewResponse(arg) {
704
+ if (!(arg instanceof wechaty_puppet_message_pb.MessagePreviewResponse)) {
705
+ throw new Error('Expected argument of type wechaty.puppet.MessagePreviewResponse');
706
+ }
707
+ return Buffer.from(arg.serializeBinary());
708
+ }
709
+
710
+ function deserialize_wechaty_puppet_MessagePreviewResponse(buffer_arg) {
711
+ return wechaty_puppet_message_pb.MessagePreviewResponse.deserializeBinary(new Uint8Array(buffer_arg));
712
+ }
713
+
692
714
  function serialize_wechaty_puppet_MessageRecallRequest(arg) {
693
715
  if (!(arg instanceof wechaty_puppet_message_pb.MessageRecallRequest)) {
694
716
  throw new Error('Expected argument of type wechaty.puppet.MessageRecallRequest');
@@ -1900,6 +1922,17 @@ messageFile: {
1900
1922
  responseSerialize: serialize_wechaty_puppet_MessageSendChannelResponse,
1901
1923
  responseDeserialize: deserialize_wechaty_puppet_MessageSendChannelResponse,
1902
1924
  },
1925
+ messagePreview: {
1926
+ path: '/wechaty.Puppet/MessagePreview',
1927
+ requestStream: false,
1928
+ responseStream: false,
1929
+ requestType: wechaty_puppet_message_pb.MessagePreviewRequest,
1930
+ responseType: wechaty_puppet_message_pb.MessagePreviewResponse,
1931
+ requestSerialize: serialize_wechaty_puppet_MessagePreviewRequest,
1932
+ requestDeserialize: deserialize_wechaty_puppet_MessagePreviewRequest,
1933
+ responseSerialize: serialize_wechaty_puppet_MessagePreviewResponse,
1934
+ responseDeserialize: deserialize_wechaty_puppet_MessagePreviewResponse,
1935
+ },
1903
1936
  // *
1904
1937
  //
1905
1938
  // Room
@@ -402,6 +402,15 @@ type PuppetMessageSendChannel = {
402
402
  readonly responseType: typeof wechaty_puppet_message_pb.MessageSendChannelResponse;
403
403
  };
404
404
 
405
+ type PuppetMessagePreview = {
406
+ readonly methodName: string;
407
+ readonly service: typeof Puppet;
408
+ readonly requestStream: false;
409
+ readonly responseStream: false;
410
+ readonly requestType: typeof wechaty_puppet_message_pb.MessagePreviewRequest;
411
+ readonly responseType: typeof wechaty_puppet_message_pb.MessagePreviewResponse;
412
+ };
413
+
405
414
  type PuppetRoomPayload = {
406
415
  readonly methodName: string;
407
416
  readonly service: typeof Puppet;
@@ -627,6 +636,7 @@ export class Puppet {
627
636
  static readonly MessageSendUrl: PuppetMessageSendUrl;
628
637
  static readonly MessageSendLocation: PuppetMessageSendLocation;
629
638
  static readonly MessageSendChannel: PuppetMessageSendChannel;
639
+ static readonly MessagePreview: PuppetMessagePreview;
630
640
  static readonly RoomPayload: PuppetRoomPayload;
631
641
  static readonly RoomList: PuppetRoomList;
632
642
  static readonly RoomAdd: PuppetRoomAdd;
@@ -1036,6 +1046,15 @@ export class PuppetClient {
1036
1046
  requestMessage: wechaty_puppet_message_pb.MessageSendChannelRequest,
1037
1047
  callback: (error: ServiceError|null, responseMessage: wechaty_puppet_message_pb.MessageSendChannelResponse|null) => void
1038
1048
  ): UnaryResponse;
1049
+ messagePreview(
1050
+ requestMessage: wechaty_puppet_message_pb.MessagePreviewRequest,
1051
+ metadata: grpc.Metadata,
1052
+ callback: (error: ServiceError|null, responseMessage: wechaty_puppet_message_pb.MessagePreviewResponse|null) => void
1053
+ ): UnaryResponse;
1054
+ messagePreview(
1055
+ requestMessage: wechaty_puppet_message_pb.MessagePreviewRequest,
1056
+ callback: (error: ServiceError|null, responseMessage: wechaty_puppet_message_pb.MessagePreviewResponse|null) => void
1057
+ ): UnaryResponse;
1039
1058
  roomPayload(
1040
1059
  requestMessage: wechaty_puppet_room_pb.RoomPayloadRequest,
1041
1060
  metadata: grpc.Metadata,
@@ -408,6 +408,15 @@ Puppet.MessageSendChannel = {
408
408
  responseType: wechaty_puppet_message_pb.MessageSendChannelResponse
409
409
  };
410
410
 
411
+ Puppet.MessagePreview = {
412
+ methodName: "MessagePreview",
413
+ service: Puppet,
414
+ requestStream: false,
415
+ responseStream: false,
416
+ requestType: wechaty_puppet_message_pb.MessagePreviewRequest,
417
+ responseType: wechaty_puppet_message_pb.MessagePreviewResponse
418
+ };
419
+
411
420
  Puppet.RoomPayload = {
412
421
  methodName: "RoomPayload",
413
422
  service: Puppet,
@@ -1962,6 +1971,37 @@ PuppetClient.prototype.messageSendChannel = function messageSendChannel(requestM
1962
1971
  };
1963
1972
  };
1964
1973
 
1974
+ PuppetClient.prototype.messagePreview = function messagePreview(requestMessage, metadata, callback) {
1975
+ if (arguments.length === 2) {
1976
+ callback = arguments[1];
1977
+ }
1978
+ var client = grpc.unary(Puppet.MessagePreview, {
1979
+ request: requestMessage,
1980
+ host: this.serviceHost,
1981
+ metadata: metadata,
1982
+ transport: this.options.transport,
1983
+ debug: this.options.debug,
1984
+ onEnd: function (response) {
1985
+ if (callback) {
1986
+ if (response.status !== grpc.Code.OK) {
1987
+ var err = new Error(response.statusMessage);
1988
+ err.code = response.status;
1989
+ err.metadata = response.trailers;
1990
+ callback(err, null);
1991
+ } else {
1992
+ callback(null, response.message);
1993
+ }
1994
+ }
1995
+ }
1996
+ });
1997
+ return {
1998
+ cancel: function () {
1999
+ callback = null;
2000
+ client.close();
2001
+ }
2002
+ };
2003
+ };
2004
+
1965
2005
  PuppetClient.prototype.roomPayload = function roomPayload(requestMessage, metadata, callback) {
1966
2006
  if (arguments.length === 2) {
1967
2007
  callback = arguments[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juzi/wechaty-grpc",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "gRPC for Wechaty",
5
5
  "type": "module",
6
6
  "exports": {
@@ -4,7 +4,7 @@
4
4
  import type { PackageJson } from 'type-fest'
5
5
  export const packageJson: PackageJson = {
6
6
  "name": "@juzi/wechaty-grpc",
7
- "version": "1.0.4",
7
+ "version": "1.0.5",
8
8
  "description": "gRPC for Wechaty",
9
9
  "type": "module",
10
10
  "exports": {