node-easywechat 2.9.3 → 3.0.0-alpha.1
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.
- package/CHANGELOG.md +8 -0
- package/README.md +20 -281
- package/dist/Core/Cache/FileCache.d.ts +6 -5
- package/dist/Core/Cache/FileCache.js +5 -5
- package/dist/Core/Config.d.ts +66 -0
- package/dist/Core/Config.js +117 -0
- package/dist/Core/Contracts/AccessTokenInterface.d.ts +13 -0
- package/dist/Core/Contracts/AccessTokenInterface.js +28 -0
- package/dist/Core/Contracts/CacheInterface.d.ts +28 -5
- package/dist/Core/Contracts/CacheInterface.js +31 -18
- package/dist/Core/Contracts/ConfigInterface.d.ts +29 -0
- package/dist/Core/Contracts/ConfigInterface.js +34 -0
- package/dist/Core/Contracts/ObjectAccessInterface.d.ts +31 -0
- package/dist/Core/Contracts/ObjectAccessInterface.js +33 -0
- package/dist/Core/Contracts/RefreshableAccessTokenInterface.d.ts +9 -0
- package/dist/{OfficialAccount/Server/Guard.js → Core/Contracts/RefreshableAccessTokenInterface.js} +9 -8
- package/dist/Core/Contracts/ServerInterface.d.ts +8 -0
- package/dist/Core/Contracts/ServerInterface.js +20 -0
- package/dist/Core/Encryptor.d.ts +29 -3
- package/dist/Core/Encryptor.js +37 -12
- package/dist/Core/Http/Contracts/MessageInterface.d.ts +69 -0
- package/dist/Core/Http/Contracts/MessageInterface.js +70 -0
- package/dist/Core/Http/Contracts/RequestInterface.d.ts +37 -0
- package/dist/Core/Http/Contracts/RequestInterface.js +42 -0
- package/dist/Core/Http/Contracts/ResponseInterface.d.ts +21 -0
- package/dist/Core/Http/Contracts/ResponseInterface.js +26 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.d.ts +78 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.js +83 -0
- package/dist/Core/Http/Minxins/MessageMixin.d.ts +24 -0
- package/dist/Core/Http/Minxins/MessageMixin.js +93 -0
- package/dist/Core/Http/Minxins/RequestMixin.d.ts +12 -0
- package/dist/Core/Http/Minxins/RequestMixin.js +30 -0
- package/dist/Core/Http/Request.d.ts +8 -25
- package/dist/Core/Http/Request.js +12 -177
- package/dist/Core/Http/Response.d.ts +11 -12
- package/dist/Core/Http/Response.js +30 -26
- package/dist/Core/Http/ServerRequest.d.ts +47 -0
- package/dist/Core/Http/ServerRequest.js +136 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.d.ts +19 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.js +47 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.d.ts +9 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.js +13 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.d.ts +18 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.js +29 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.d.ts +35 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.js +37 -0
- package/dist/Core/HttpClient/HttpClient.d.ts +20 -0
- package/dist/Core/HttpClient/HttpClient.js +92 -0
- package/dist/Core/HttpClient/HttpClientResponse.d.ts +76 -0
- package/dist/Core/HttpClient/HttpClientResponse.js +171 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.d.ts +48 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.js +88 -0
- package/dist/Core/Message.d.ts +144 -0
- package/dist/Core/Message.js +74 -0
- package/dist/Core/Mixins/CacheMixin.d.ts +40 -0
- package/dist/Core/Mixins/CacheMixin.js +63 -0
- package/dist/Core/Mixins/ClientMixin.d.ts +16 -0
- package/dist/Core/Mixins/ClientMixin.js +21 -0
- package/dist/Core/Mixins/ConfigMixin.d.ts +16 -0
- package/dist/Core/Mixins/ConfigMixin.js +21 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.d.ts +11 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.js +38 -0
- package/dist/Core/Mixins/HandlersMixin.d.ts +79 -0
- package/dist/Core/Mixins/HandlersMixin.js +163 -0
- package/dist/Core/Mixins/HasAttributesMixin.d.ts +46 -0
- package/dist/Core/Mixins/HasAttributesMixin.js +75 -0
- package/dist/Core/Mixins/HttpClientMixin.d.ts +26 -0
- package/dist/Core/Mixins/HttpClientMixin.js +45 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.d.ts +13 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.js +63 -0
- package/dist/Core/Mixins/ServerRequestMixin.d.ts +16 -0
- package/dist/Core/Mixins/ServerRequestMixin.js +21 -0
- package/dist/Core/{AES.d.ts → Support/AES.d.ts} +0 -0
- package/dist/Core/{AES.js → Support/AES.js} +0 -0
- package/dist/Core/Support/Obj.d.ts +62 -0
- package/dist/Core/Support/Obj.js +136 -0
- package/dist/Core/{PKCS.d.ts → Support/PKCS.d.ts} +2 -1
- package/dist/Core/{PKCS.js → Support/PKCS.js} +1 -3
- package/dist/Core/{RSA.d.ts → Support/RSA.d.ts} +2 -1
- package/dist/Core/{RSA.js → Support/RSA.js} +1 -2
- package/dist/Core/Support/Utils.d.ts +89 -0
- package/dist/Core/{Utils.js → Support/Utils.js} +84 -40
- package/dist/OfficialAccount/AccessToken.d.ts +26 -0
- package/dist/OfficialAccount/AccessToken.js +83 -0
- package/dist/OfficialAccount/Account.d.ts +13 -0
- package/dist/OfficialAccount/Account.js +29 -0
- package/dist/OfficialAccount/Application.d.ts +70 -66
- package/dist/OfficialAccount/Application.js +146 -222
- package/dist/OfficialAccount/Config.d.ts +5 -0
- package/dist/OfficialAccount/Config.js +14 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.d.ts +23 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.js +25 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.d.ts +87 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.js +76 -0
- package/dist/OfficialAccount/JsApiTicket.d.ts +23 -0
- package/dist/OfficialAccount/JsApiTicket.js +76 -0
- package/dist/OfficialAccount/Message.d.ts +4 -0
- package/dist/OfficialAccount/Message.js +8 -0
- package/dist/OfficialAccount/Server.d.ts +43 -0
- package/dist/OfficialAccount/Server.js +96 -0
- package/dist/OfficialAccount/Utils.d.ts +7 -0
- package/dist/{Work/MiniProgram/Auth/AuthClient.js → OfficialAccount/Utils.js} +14 -13
- package/dist/Types/global.d.ts +343 -0
- package/official_account.access_token.mock-access_token-appid.cache +1 -0
- package/official_account.jsapi_ticket.mock-ticket-appid.cache +1 -0
- package/package.json +13 -10
- package/dist/BaseService/Application.d.ts +0 -17
- package/dist/BaseService/Application.js +0 -46
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.d.ts +0 -16
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.js +0 -47
- package/dist/BaseService/Jssdk/JssdkClient.d.ts +0 -52
- package/dist/BaseService/Jssdk/JssdkClient.js +0 -128
- package/dist/BaseService/Media/MediaClient.d.ts +0 -57
- package/dist/BaseService/Media/MediaClient.js +0 -151
- package/dist/BaseService/Qrcode/QrcodeClient.d.ts +0 -28
- package/dist/BaseService/Qrcode/QrcodeClient.js +0 -79
- package/dist/BaseService/Url/UrlClient.d.ts +0 -9
- package/dist/BaseService/Url/UrlClient.js +0 -24
- package/dist/Core/BaseAccessToken.d.ts +0 -89
- package/dist/Core/BaseAccessToken.js +0 -206
- package/dist/Core/BaseApplication.d.ts +0 -72
- package/dist/Core/BaseApplication.js +0 -138
- package/dist/Core/BaseClient.d.ts +0 -20
- package/dist/Core/BaseClient.js +0 -109
- package/dist/Core/Contracts/RequestInterface.d.ts +0 -10
- package/dist/Core/Contracts/RequestInterface.js +0 -30
- package/dist/Core/Decorators/FinallResult.d.ts +0 -4
- package/dist/Core/Decorators/FinallResult.js +0 -8
- package/dist/Core/Decorators/TerminateResult.d.ts +0 -4
- package/dist/Core/Decorators/TerminateResult.js +0 -8
- package/dist/Core/Http/StreamResponse.d.ts +0 -6
- package/dist/Core/Http/StreamResponse.js +0 -40
- package/dist/Core/Messages/Article.d.ts +0 -7
- package/dist/Core/Messages/Article.js +0 -31
- package/dist/Core/Messages/Card.d.ts +0 -6
- package/dist/Core/Messages/Card.js +0 -15
- package/dist/Core/Messages/DeviceEvent.d.ts +0 -5
- package/dist/Core/Messages/DeviceEvent.js +0 -19
- package/dist/Core/Messages/DeviceText.d.ts +0 -6
- package/dist/Core/Messages/DeviceText.js +0 -27
- package/dist/Core/Messages/File.d.ts +0 -4
- package/dist/Core/Messages/File.js +0 -12
- package/dist/Core/Messages/Image.d.ts +0 -4
- package/dist/Core/Messages/Image.js +0 -12
- package/dist/Core/Messages/InteractiveTaskCard.d.ts +0 -8
- package/dist/Core/Messages/InteractiveTaskCard.js +0 -22
- package/dist/Core/Messages/Link.d.ts +0 -5
- package/dist/Core/Messages/Link.js +0 -17
- package/dist/Core/Messages/Location.d.ts +0 -5
- package/dist/Core/Messages/Location.js +0 -19
- package/dist/Core/Messages/Markdown.d.ts +0 -5
- package/dist/Core/Messages/Markdown.js +0 -15
- package/dist/Core/Messages/Media.d.ts +0 -8
- package/dist/Core/Messages/Media.js +0 -31
- package/dist/Core/Messages/Message.d.ts +0 -47
- package/dist/Core/Messages/Message.js +0 -133
- package/dist/Core/Messages/MiniProgramNotice.d.ts +0 -5
- package/dist/Core/Messages/MiniProgramNotice.js +0 -16
- package/dist/Core/Messages/MiniProgramPage.d.ts +0 -6
- package/dist/Core/Messages/MiniProgramPage.js +0 -23
- package/dist/Core/Messages/Music.d.ts +0 -7
- package/dist/Core/Messages/Music.js +0 -39
- package/dist/Core/Messages/News.d.ts +0 -9
- package/dist/Core/Messages/News.js +0 -50
- package/dist/Core/Messages/NewsItem.d.ts +0 -7
- package/dist/Core/Messages/NewsItem.js +0 -34
- package/dist/Core/Messages/Raw.d.ts +0 -9
- package/dist/Core/Messages/Raw.js +0 -26
- package/dist/Core/Messages/ReplyInteractiveTaskCard.d.ts +0 -10
- package/dist/Core/Messages/ReplyInteractiveTaskCard.js +0 -25
- package/dist/Core/Messages/ShortVideo.d.ts +0 -4
- package/dist/Core/Messages/ShortVideo.js +0 -12
- package/dist/Core/Messages/TaskCard.d.ts +0 -5
- package/dist/Core/Messages/TaskCard.js +0 -19
- package/dist/Core/Messages/Text.d.ts +0 -7
- package/dist/Core/Messages/Text.js +0 -20
- package/dist/Core/Messages/TextCard.d.ts +0 -5
- package/dist/Core/Messages/TextCard.js +0 -17
- package/dist/Core/Messages/Transfer.d.ts +0 -7
- package/dist/Core/Messages/Transfer.js +0 -22
- package/dist/Core/Messages/Video.d.ts +0 -7
- package/dist/Core/Messages/Video.js +0 -33
- package/dist/Core/Messages/Voice.d.ts +0 -5
- package/dist/Core/Messages/Voice.js +0 -16
- package/dist/Core/Messages/index.d.ts +0 -24
- package/dist/Core/Messages/index.js +0 -36
- package/dist/Core/Mixins/HttpMixin.d.ts +0 -4
- package/dist/Core/Mixins/HttpMixin.js +0 -57
- package/dist/Core/ServerGuard.d.ts +0 -54
- package/dist/Core/ServerGuard.js +0 -288
- package/dist/Core/Types.d.ts +0 -237
- package/dist/Core/Types.js +0 -3
- package/dist/Core/Utils.d.ts +0 -31
- package/dist/MicroMerchant/Application.d.ts +0 -27
- package/dist/MicroMerchant/Application.js +0 -105
- package/dist/MicroMerchant/Base/MicroMerchantBase.d.ts +0 -7
- package/dist/MicroMerchant/Base/MicroMerchantBase.js +0 -52
- package/dist/MicroMerchant/Certficates/CertficatesClient.d.ts +0 -5
- package/dist/MicroMerchant/Certficates/CertficatesClient.js +0 -52
- package/dist/MicroMerchant/Core/BaseClient.d.ts +0 -9
- package/dist/MicroMerchant/Core/BaseClient.js +0 -106
- package/dist/MicroMerchant/Media/MediaClient.d.ts +0 -6
- package/dist/MicroMerchant/Media/MediaClient.js +0 -33
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.d.ts +0 -8
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +0 -49
- package/dist/MicroMerchant/Meterial/MeterialClient.d.ts +0 -5
- package/dist/MicroMerchant/Meterial/MeterialClient.js +0 -30
- package/dist/MicroMerchant/Withdraw/WithdrawClient.d.ts +0 -5
- package/dist/MicroMerchant/Withdraw/WithdrawClient.js +0 -28
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.d.ts +0 -6
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +0 -42
- package/dist/MiniProgram/AppCode/AppCodeClient.d.ts +0 -22
- package/dist/MiniProgram/AppCode/AppCodeClient.js +0 -79
- package/dist/MiniProgram/Application.d.ts +0 -83
- package/dist/MiniProgram/Application.js +0 -238
- package/dist/MiniProgram/Auth/AccessToken.d.ts +0 -5
- package/dist/MiniProgram/Auth/AccessToken.js +0 -31
- package/dist/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/MiniProgram/Auth/AuthClient.js +0 -22
- package/dist/MiniProgram/Base/MiniProgramBase.d.ts +0 -9
- package/dist/MiniProgram/Base/MiniProgramBase.js +0 -21
- package/dist/MiniProgram/Broadcast/BroadcastClient.d.ts +0 -40
- package/dist/MiniProgram/Broadcast/BroadcastClient.js +0 -141
- package/dist/MiniProgram/DataCube/DataCubeClient.d.ts +0 -70
- package/dist/MiniProgram/DataCube/DataCubeClient.js +0 -116
- package/dist/MiniProgram/Encryptor.d.ts +0 -4
- package/dist/MiniProgram/Encryptor.js +0 -23
- package/dist/MiniProgram/Express/ExpressClient.d.ts +0 -65
- package/dist/MiniProgram/Express/ExpressClient.js +0 -113
- package/dist/MiniProgram/Live/LiveClient.d.ts +0 -5
- package/dist/MiniProgram/Live/LiveClient.js +0 -23
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.d.ts +0 -31
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +0 -67
- package/dist/MiniProgram/OpenData/OpenDataClient.d.ts +0 -7
- package/dist/MiniProgram/OpenData/OpenDataClient.js +0 -46
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +0 -10
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +0 -20
- package/dist/MiniProgram/Plugin/PluginClient.d.ts +0 -17
- package/dist/MiniProgram/Plugin/PluginClient.js +0 -37
- package/dist/MiniProgram/Plugin/PluginDevClient.d.ts +0 -23
- package/dist/MiniProgram/Plugin/PluginDevClient.js +0 -49
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.d.ts +0 -11
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +0 -25
- package/dist/MiniProgram/RiskControl/RiskControlClient.d.ts +0 -4
- package/dist/MiniProgram/RiskControl/RiskControlClient.js +0 -12
- package/dist/MiniProgram/Search/SearchClient.d.ts +0 -4
- package/dist/MiniProgram/Search/SearchClient.js +0 -14
- package/dist/MiniProgram/Shop/AccoutClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/AccoutClient.js +0 -42
- package/dist/MiniProgram/Shop/AftersaleClient.d.ts +0 -22
- package/dist/MiniProgram/Shop/AftersaleClient.js +0 -35
- package/dist/MiniProgram/Shop/BasicClient.d.ts +0 -39
- package/dist/MiniProgram/Shop/BasicClient.js +0 -69
- package/dist/MiniProgram/Shop/DeliveryClient.d.ts +0 -20
- package/dist/MiniProgram/Shop/DeliveryClient.js +0 -32
- package/dist/MiniProgram/Shop/OrderClient.d.ts +0 -39
- package/dist/MiniProgram/Shop/OrderClient.js +0 -60
- package/dist/MiniProgram/Shop/RegisterClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/RegisterClient.js +0 -43
- package/dist/MiniProgram/Shop/SpuClient.d.ts +0 -67
- package/dist/MiniProgram/Shop/SpuClient.js +0 -92
- package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +0 -11
- package/dist/MiniProgram/ShortLink/ShortLinkClient.js +0 -23
- package/dist/MiniProgram/Soter/SoterClient.d.ts +0 -10
- package/dist/MiniProgram/Soter/SoterClient.js +0 -22
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.d.ts +0 -50
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +0 -122
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.d.ts +0 -18
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.js +0 -50
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.d.ts +0 -26
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +0 -68
- package/dist/MiniProgram/Union/UnionClient.d.ts +0 -16
- package/dist/MiniProgram/Union/UnionClient.js +0 -69
- package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +0 -9
- package/dist/MiniProgram/UrlLink/UrlLinkClient.js +0 -17
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.d.ts +0 -4
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.js +0 -12
- package/dist/OfficialAccount/Auth/AccessToken.d.ts +0 -5
- package/dist/OfficialAccount/Auth/AccessToken.js +0 -31
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.d.ts +0 -7
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.js +0 -15
- package/dist/OfficialAccount/Base/OfficialAccountBase.d.ts +0 -18
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +0 -47
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.d.ts +0 -158
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +0 -233
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.d.ts +0 -14
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +0 -63
- package/dist/OfficialAccount/Card/BoardingPassClient.d.ts +0 -4
- package/dist/OfficialAccount/Card/BoardingPassClient.js +0 -12
- package/dist/OfficialAccount/Card/Card.d.ts +0 -17
- package/dist/OfficialAccount/Card/Card.js +0 -31
- package/dist/OfficialAccount/Card/Client.d.ts +0 -108
- package/dist/OfficialAccount/Card/Client.js +0 -218
- package/dist/OfficialAccount/Card/CodeClient.d.ts +0 -51
- package/dist/OfficialAccount/Card/CodeClient.js +0 -100
- package/dist/OfficialAccount/Card/CoinClient.d.ts +0 -10
- package/dist/OfficialAccount/Card/CoinClient.js +0 -41
- package/dist/OfficialAccount/Card/GeneralCardClient.d.ts +0 -19
- package/dist/OfficialAccount/Card/GeneralCardClient.js +0 -34
- package/dist/OfficialAccount/Card/JssdkClient.d.ts +0 -6
- package/dist/OfficialAccount/Card/JssdkClient.js +0 -67
- package/dist/OfficialAccount/Card/MeetingTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MeetingTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/MemberCardClient.d.ts +0 -35
- package/dist/OfficialAccount/Card/MemberCardClient.js +0 -62
- package/dist/OfficialAccount/Card/MovieTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MovieTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/SubMerchantClient.d.ts +0 -26
- package/dist/OfficialAccount/Card/SubMerchantClient.js +0 -73
- package/dist/OfficialAccount/Comment/CommentClient.d.ts +0 -60
- package/dist/OfficialAccount/Comment/CommentClient.js +0 -115
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.d.ts +0 -15
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +0 -78
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.d.ts +0 -8
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.js +0 -36
- package/dist/OfficialAccount/CustomerService/Messenger.d.ts +0 -18
- package/dist/OfficialAccount/CustomerService/Messenger.js +0 -62
- package/dist/OfficialAccount/DataCube/DataCubeClient.d.ts +0 -135
- package/dist/OfficialAccount/DataCube/DataCubeClient.js +0 -203
- package/dist/OfficialAccount/Device/DeviceClient.d.ts +0 -15
- package/dist/OfficialAccount/Device/DeviceClient.js +0 -70
- package/dist/OfficialAccount/Goods/GoodsClient.d.ts +0 -30
- package/dist/OfficialAccount/Goods/GoodsClient.js +0 -60
- package/dist/OfficialAccount/Material/MaterialClient.d.ts +0 -67
- package/dist/OfficialAccount/Material/MaterialClient.js +0 -193
- package/dist/OfficialAccount/Menu/MenuClient.d.ts +0 -27
- package/dist/OfficialAccount/Menu/MenuClient.js +0 -58
- package/dist/OfficialAccount/OCR/OCRClient.d.ts +0 -40
- package/dist/OfficialAccount/OCR/OCRClient.js +0 -85
- package/dist/OfficialAccount/POI/POIClient.d.ts +0 -39
- package/dist/OfficialAccount/POI/POIClient.js +0 -87
- package/dist/OfficialAccount/Semantic/SemanticClient.d.ts +0 -10
- package/dist/OfficialAccount/Semantic/SemanticClient.js +0 -24
- package/dist/OfficialAccount/Server/Guard.d.ts +0 -4
- package/dist/OfficialAccount/ShakeAround/Client.d.ts +0 -23
- package/dist/OfficialAccount/ShakeAround/Client.js +0 -43
- package/dist/OfficialAccount/ShakeAround/DeviceClient.d.ts +0 -51
- package/dist/OfficialAccount/ShakeAround/DeviceClient.js +0 -100
- package/dist/OfficialAccount/ShakeAround/GroupClient.d.ts +0 -44
- package/dist/OfficialAccount/ShakeAround/GroupClient.js +0 -84
- package/dist/OfficialAccount/ShakeAround/MaterialClient.d.ts +0 -9
- package/dist/OfficialAccount/ShakeAround/MaterialClient.js +0 -21
- package/dist/OfficialAccount/ShakeAround/PageClient.d.ts +0 -30
- package/dist/OfficialAccount/ShakeAround/PageClient.js +0 -56
- package/dist/OfficialAccount/ShakeAround/RelationClient.d.ts +0 -21
- package/dist/OfficialAccount/ShakeAround/RelationClient.js +0 -44
- package/dist/OfficialAccount/ShakeAround/ShakeAround.d.ts +0 -14
- package/dist/OfficialAccount/ShakeAround/ShakeAround.js +0 -25
- package/dist/OfficialAccount/ShakeAround/StatsClient.d.ts +0 -29
- package/dist/OfficialAccount/ShakeAround/StatsClient.js +0 -57
- package/dist/OfficialAccount/Store/StoreClient.d.ts +0 -63
- package/dist/OfficialAccount/Store/StoreClient.js +0 -104
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.d.ts +0 -39
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +0 -116
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.d.ts +0 -42
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +0 -114
- package/dist/OfficialAccount/User/TagClient.d.ts +0 -46
- package/dist/OfficialAccount/User/TagClient.js +0 -92
- package/dist/OfficialAccount/User/UserClient.d.ts +0 -47
- package/dist/OfficialAccount/User/UserClient.js +0 -95
- package/dist/OpenPlatform/Application.d.ts +0 -88
- package/dist/OpenPlatform/Application.js +0 -223
- package/dist/OpenPlatform/Auth/AccessToken.d.ts +0 -7
- package/dist/OpenPlatform/Auth/AccessToken.js +0 -33
- package/dist/OpenPlatform/Auth/VerifyTicket.d.ts +0 -8
- package/dist/OpenPlatform/Auth/VerifyTicket.js +0 -40
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.js +0 -45
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +0 -43
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.d.ts +0 -15
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.d.ts +0 -11
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.js +0 -39
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.d.ts +0 -85
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.js +0 -152
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.d.ts +0 -14
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.js +0 -27
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.d.ts +0 -72
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.js +0 -133
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.d.ts +0 -17
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.js +0 -35
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.d.ts +0 -18
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +0 -38
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.d.ts +0 -7
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.js +0 -22
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.d.ts +0 -19
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.js +0 -37
- package/dist/OpenPlatform/Authorizer/Server/Guard.d.ts +0 -4
- package/dist/OpenPlatform/Authorizer/Server/Guard.js +0 -13
- package/dist/OpenPlatform/Base/OpenPlatformBase.d.ts +0 -40
- package/dist/OpenPlatform/Base/OpenPlatformBase.js +0 -83
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.d.ts +0 -23
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.js +0 -48
- package/dist/OpenPlatform/Component/ComponentClient.d.ts +0 -15
- package/dist/OpenPlatform/Component/ComponentClient.js +0 -33
- package/dist/OpenPlatform/Server/OpenPlatformGuard.d.ts +0 -11
- package/dist/OpenPlatform/Server/OpenPlatformGuard.js +0 -54
- package/dist/OpenWork/Application.d.ts +0 -37
- package/dist/OpenWork/Application.js +0 -128
- package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/ProviderAccessToken.js +0 -33
- package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteAccessToken.js +0 -34
- package/dist/OpenWork/Auth/SuiteTicket.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteTicket.js +0 -40
- package/dist/OpenWork/Corp/CorpClient.d.ts +0 -72
- package/dist/OpenWork/Corp/CorpClient.js +0 -150
- package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +0 -5
- package/dist/OpenWork/MiniProgram/MiniProgramClient.js +0 -18
- package/dist/OpenWork/Provider/ProviderClient.d.ts +0 -81
- package/dist/OpenWork/Provider/ProviderClient.js +0 -172
- package/dist/OpenWork/Server/OpenWorkGuard.d.ts +0 -13
- package/dist/OpenWork/Server/OpenWorkGuard.js +0 -51
- package/dist/OpenWork/Work/Application.d.ts +0 -5
- package/dist/OpenWork/Work/Application.js +0 -22
- package/dist/OpenWork/Work/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenWork/Work/Auth/AccessToken.js +0 -44
- package/dist/Payment/Application.d.ts +0 -76
- package/dist/Payment/Application.js +0 -199
- package/dist/Payment/Base/PaymentBase.d.ts +0 -13
- package/dist/Payment/Base/PaymentBase.js +0 -40
- package/dist/Payment/Bill/BillClient.d.ts +0 -10
- package/dist/Payment/Bill/BillClient.js +0 -43
- package/dist/Payment/Core/BaseClient.d.ts +0 -17
- package/dist/Payment/Core/BaseClient.js +0 -116
- package/dist/Payment/Coupon/CouponClient.d.ts +0 -6
- package/dist/Payment/Coupon/CouponClient.js +0 -37
- package/dist/Payment/Jssdk/JssdkClient.d.ts +0 -38
- package/dist/Payment/Jssdk/JssdkClient.js +0 -122
- package/dist/Payment/Merchant/MerchantClient.d.ts +0 -7
- package/dist/Payment/Merchant/MerchantClient.js +0 -40
- package/dist/Payment/Notify/Handler.d.ts +0 -25
- package/dist/Payment/Notify/Handler.js +0 -96
- package/dist/Payment/Notify/Paid.d.ts +0 -6
- package/dist/Payment/Notify/Paid.js +0 -32
- package/dist/Payment/Notify/Refunded.d.ts +0 -7
- package/dist/Payment/Notify/Refunded.js +0 -39
- package/dist/Payment/Notify/Scanned.d.ts +0 -9
- package/dist/Payment/Notify/Scanned.js +0 -54
- package/dist/Payment/Order/OrderClient.d.ts +0 -25
- package/dist/Payment/Order/OrderClient.js +0 -76
- package/dist/Payment/ProfitSharing/ProfitSharingClient.d.ts +0 -10
- package/dist/Payment/ProfitSharing/ProfitSharingClient.js +0 -59
- package/dist/Payment/Redpack/RedpackClient.d.ts +0 -23
- package/dist/Payment/Redpack/RedpackClient.js +0 -73
- package/dist/Payment/Refund/RefundClient.d.ts +0 -43
- package/dist/Payment/Refund/RefundClient.js +0 -80
- package/dist/Payment/Reverse/ReverseClient.d.ts +0 -14
- package/dist/Payment/Reverse/ReverseClient.js +0 -30
- package/dist/Payment/Sandbox/SandboxClient.d.ts +0 -8
- package/dist/Payment/Sandbox/SandboxClient.js +0 -40
- package/dist/Payment/Security/SecurityClient.d.ts +0 -7
- package/dist/Payment/Security/SecurityClient.js +0 -18
- package/dist/Payment/Transfer/TransferClient.d.ts +0 -23
- package/dist/Payment/Transfer/TransferClient.js +0 -78
- package/dist/Work/Agent/AgentClient.d.ts +0 -6
- package/dist/Work/Agent/AgentClient.js +0 -25
- package/dist/Work/Agent/WorkbenchClient.d.ts +0 -24
- package/dist/Work/Agent/WorkbenchClient.js +0 -39
- package/dist/Work/Application.d.ts +0 -80
- package/dist/Work/Application.js +0 -263
- package/dist/Work/Auth/AccessToken.d.ts +0 -5
- package/dist/Work/Auth/AccessToken.js +0 -36
- package/dist/Work/Base/WorkBase.d.ts +0 -4
- package/dist/Work/Base/WorkBase.js +0 -12
- package/dist/Work/Calendar/CalendarClient.d.ts +0 -7
- package/dist/Work/Calendar/CalendarClient.js +0 -32
- package/dist/Work/Chat/ChatClient.d.ts +0 -7
- package/dist/Work/Chat/ChatClient.js +0 -27
- package/dist/Work/CorpGroup/CorpGroupClient.d.ts +0 -40
- package/dist/Work/CorpGroup/CorpGroupClient.js +0 -68
- package/dist/Work/Department/DepartmentClient.d.ts +0 -7
- package/dist/Work/Department/DepartmentClient.js +0 -29
- package/dist/Work/ExternalContact/Client.d.ts +0 -222
- package/dist/Work/ExternalContact/Client.js +0 -365
- package/dist/Work/ExternalContact/ContactWayClient.d.ts +0 -44
- package/dist/Work/ExternalContact/ContactWayClient.js +0 -82
- package/dist/Work/ExternalContact/GroupChatWayClient.d.ts +0 -32
- package/dist/Work/ExternalContact/GroupChatWayClient.js +0 -54
- package/dist/Work/ExternalContact/MessageClient.d.ts +0 -58
- package/dist/Work/ExternalContact/MessageClient.js +0 -158
- package/dist/Work/ExternalContact/MessageTemplateClient.d.ts +0 -14
- package/dist/Work/ExternalContact/MessageTemplateClient.js +0 -78
- package/dist/Work/ExternalContact/MomentClient.d.ts +0 -61
- package/dist/Work/ExternalContact/MomentClient.js +0 -104
- package/dist/Work/ExternalContact/SchoolClient.d.ts +0 -28
- package/dist/Work/ExternalContact/SchoolClient.js +0 -177
- package/dist/Work/ExternalContact/StatisticsClient.d.ts +0 -28
- package/dist/Work/ExternalContact/StatisticsClient.js +0 -52
- package/dist/Work/GroupRobot/GroupRobotClient.d.ts +0 -7
- package/dist/Work/GroupRobot/GroupRobotClient.js +0 -18
- package/dist/Work/GroupRobot/Messages/Image.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Image.js +0 -15
- package/dist/Work/GroupRobot/Messages/Markdown.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Markdown.js +0 -14
- package/dist/Work/GroupRobot/Messages/Message.d.ts +0 -3
- package/dist/Work/GroupRobot/Messages/Message.js +0 -7
- package/dist/Work/GroupRobot/Messages/News.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/News.js +0 -32
- package/dist/Work/GroupRobot/Messages/NewsItem.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/NewsItem.js +0 -20
- package/dist/Work/GroupRobot/Messages/Text.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/Text.js +0 -24
- package/dist/Work/GroupRobot/Messages/index.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/index.js +0 -18
- package/dist/Work/GroupRobot/Messenger.d.ts +0 -11
- package/dist/Work/GroupRobot/Messenger.js +0 -39
- package/dist/Work/Invoice/InvoiceClient.d.ts +0 -7
- package/dist/Work/Invoice/InvoiceClient.js +0 -38
- package/dist/Work/Jssdk/JssdkClient.d.ts +0 -21
- package/dist/Work/Jssdk/JssdkClient.js +0 -106
- package/dist/Work/Kf/KfAccountClient.d.ts +0 -41
- package/dist/Work/Kf/KfAccountClient.js +0 -71
- package/dist/Work/Kf/KfMessageClient.d.ts +0 -44
- package/dist/Work/Kf/KfMessageClient.js +0 -73
- package/dist/Work/Kf/KfServicerClient.d.ts +0 -26
- package/dist/Work/Kf/KfServicerClient.js +0 -47
- package/dist/Work/Live/LiveClient.d.ts +0 -6
- package/dist/Work/Live/LiveClient.js +0 -32
- package/dist/Work/Media/MediaClient.d.ts +0 -52
- package/dist/Work/Media/MediaClient.js +0 -124
- package/dist/Work/Menu/MenuClient.d.ts +0 -6
- package/dist/Work/Menu/MenuClient.js +0 -24
- package/dist/Work/Message/MessageClient.d.ts +0 -7
- package/dist/Work/Message/MessageClient.js +0 -16
- package/dist/Work/Message/Messenger.d.ts +0 -18
- package/dist/Work/Message/Messenger.js +0 -69
- package/dist/Work/MiniProgram/Application.d.ts +0 -7
- package/dist/Work/MiniProgram/Application.js +0 -26
- package/dist/Work/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/Work/MsgAudit/MsgAuditClient.d.ts +0 -7
- package/dist/Work/MsgAudit/MsgAuditClient.js +0 -32
- package/dist/Work/OA/OAClient.d.ts +0 -11
- package/dist/Work/OA/OAClient.js +0 -67
- package/dist/Work/Schedule/ScheduleClient.d.ts +0 -8
- package/dist/Work/Schedule/ScheduleClient.js +0 -39
- package/dist/Work/Server/Guard.d.ts +0 -6
- package/dist/Work/Server/Guard.js +0 -34
- package/dist/Work/User/TagClient.d.ts +0 -13
- package/dist/Work/User/TagClient.js +0 -53
- package/dist/Work/User/UserClient.d.ts +0 -16
- package/dist/Work/User/UserClient.js +0 -80
- package/dist/index.d.ts +0 -119
- package/dist/index.js +0 -86
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const merge_1 = __importDefault(require("merge"));
|
|
16
|
+
const Utils_1 = require("../Support/Utils");
|
|
17
|
+
class HttpClientResponse {
|
|
18
|
+
constructor(response, failureJudge = null, throwError = true) {
|
|
19
|
+
this.response = null;
|
|
20
|
+
this.failureJudge = null;
|
|
21
|
+
this.throwError = false;
|
|
22
|
+
this.response = response;
|
|
23
|
+
this.failureJudge = failureJudge;
|
|
24
|
+
this.throwError = throwError;
|
|
25
|
+
}
|
|
26
|
+
withThrowError(throwError) {
|
|
27
|
+
this.throwError = throwError;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
throwOnFailure() {
|
|
31
|
+
return this.withThrowError(true);
|
|
32
|
+
}
|
|
33
|
+
quietly() {
|
|
34
|
+
return this.withThrowError(false);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 设置错误判断方法
|
|
38
|
+
* @param closure
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
judgeFailureUsing(closure) {
|
|
42
|
+
this.failureJudge = closure;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 获取请求是否失败
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
isFailed() {
|
|
50
|
+
if (this.failureJudge) {
|
|
51
|
+
return this.failureJudge(this);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return 400 <= this.getStatusCode();
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 获取请求是否成功
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
isSuccessful() {
|
|
65
|
+
return !this.isFailed();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 返回对象格式
|
|
69
|
+
* @param throwError
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
toObject(throwError = null) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
throwError = throwError === null ? this.throwError : throwError;
|
|
75
|
+
let content = this.response.data;
|
|
76
|
+
if (!content) {
|
|
77
|
+
throw new Error('Response body is empty.');
|
|
78
|
+
}
|
|
79
|
+
let contentType = this.getHeader('content-type') || '';
|
|
80
|
+
if (contentType && (contentType.indexOf('text/xml') > -1 || contentType.indexOf('application/xml') > -1 || content.indexOf('<xml>') > -1)) {
|
|
81
|
+
return (0, Utils_1.parseXml)(content);
|
|
82
|
+
}
|
|
83
|
+
return content;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 返回json字符串
|
|
88
|
+
* @param throwError
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
toJson(throwError = null) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
return JSON.stringify(yield this.toObject(throwError));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 返回字符串
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
toString() {
|
|
101
|
+
return this.toJson();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 另存为文件
|
|
105
|
+
* @param filename 完整的文件名(含路径)
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
saveAs(filename) {
|
|
109
|
+
let buffer = this.response.data;
|
|
110
|
+
let content = buffer.toString();
|
|
111
|
+
if (!content || '{' === content[0]) {
|
|
112
|
+
throw new Error('Invalid media response content.');
|
|
113
|
+
}
|
|
114
|
+
fs_1.default.writeFileSync(filename, buffer);
|
|
115
|
+
return filename;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 返回base64字符串
|
|
119
|
+
* @returns
|
|
120
|
+
*/
|
|
121
|
+
toDataUrl() {
|
|
122
|
+
return 'data:' + this.getHeader('content-type') + ';base64,' + this.response.data;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 判断header是否存在
|
|
126
|
+
* @param key
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
hasHeader(key) {
|
|
130
|
+
return Object.keys(this.getHeaders()).findIndex(o => o === key) > -1;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 获取单个header
|
|
134
|
+
* @param key
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
getHeader(key) {
|
|
138
|
+
return this.getHeaders()[key] || null;
|
|
139
|
+
}
|
|
140
|
+
getStatusCode() {
|
|
141
|
+
return this.response.status;
|
|
142
|
+
}
|
|
143
|
+
getHeaders(throwError) {
|
|
144
|
+
let headers = merge_1.default.recursive(true, this.response.headers);
|
|
145
|
+
for (let key in this.response.headers) {
|
|
146
|
+
if (key !== key.toLowerCase()) {
|
|
147
|
+
this.response.headers[key.toLowerCase()] = this.response.headers[key];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return headers;
|
|
151
|
+
}
|
|
152
|
+
getContent(throwError) {
|
|
153
|
+
return this.response.data;
|
|
154
|
+
}
|
|
155
|
+
cancel() {
|
|
156
|
+
}
|
|
157
|
+
getInfo(type) {
|
|
158
|
+
return this.response.config;
|
|
159
|
+
}
|
|
160
|
+
offsetExists(key) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
return Object.keys(yield this.toObject()).findIndex(o => o === key) > -1;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
offsetGet(key) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
return (yield this.toObject())[key] || null;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
module.exports = HttpClientResponse;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import HttpClientInterface from "../Contracts/HttpClientInterface";
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import HttpClientResponse from "../HttpClientResponse";
|
|
4
|
+
declare class HttpClientMethodsMixin extends HttpClientInterface {
|
|
5
|
+
/**
|
|
6
|
+
* 发送get请求
|
|
7
|
+
* @param url
|
|
8
|
+
* @param payload
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
get(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* 发送post请求
|
|
14
|
+
* @param url
|
|
15
|
+
* @param payload
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
post(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* 发送post请求(JSON数据)
|
|
21
|
+
* @param url
|
|
22
|
+
* @param payload
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
postJson(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* 发送patch请求
|
|
28
|
+
* @param url
|
|
29
|
+
* @param payload
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
patch(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* 发送put请求
|
|
35
|
+
* @param url
|
|
36
|
+
* @param payload
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
put(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* 发送delete请求
|
|
42
|
+
* @param url
|
|
43
|
+
* @param payload
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
delete(url: string, payload?: AxiosRequestConfig): Promise<HttpClientResponse>;
|
|
47
|
+
}
|
|
48
|
+
export = HttpClientMethodsMixin;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
const HttpClientInterface_1 = __importDefault(require("../Contracts/HttpClientInterface"));
|
|
15
|
+
class HttpClientMethodsMixin extends HttpClientInterface_1.default {
|
|
16
|
+
/**
|
|
17
|
+
* 发送get请求
|
|
18
|
+
* @param url
|
|
19
|
+
* @param payload
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
get(url, payload = {}) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return this.request('get', url, payload);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 发送post请求
|
|
29
|
+
* @param url
|
|
30
|
+
* @param payload
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
post(url, payload = {}) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return this.request('post', url, payload);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 发送post请求(JSON数据)
|
|
40
|
+
* @param url
|
|
41
|
+
* @param payload
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
postJson(url, payload = {}) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (!payload)
|
|
47
|
+
payload = {};
|
|
48
|
+
if (!payload['headers'])
|
|
49
|
+
payload['headers'] = {};
|
|
50
|
+
payload['headers']['Content-Type'] = 'application/json';
|
|
51
|
+
return this.request('post', url, payload);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 发送patch请求
|
|
56
|
+
* @param url
|
|
57
|
+
* @param payload
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
patch(url, payload = {}) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return this.request('patch', url, payload);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 发送put请求
|
|
67
|
+
* @param url
|
|
68
|
+
* @param payload
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
put(url, payload = {}) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
return this.request('put', url, payload);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 发送delete请求
|
|
78
|
+
* @param url
|
|
79
|
+
* @param payload
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
delete(url, payload = {}) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return this.request('delete', url, payload);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
module.exports = HttpClientMethodsMixin;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import ServerRequestInterface from "./Http/Contracts/ServerRequestInterface";
|
|
2
|
+
import HasAttributesMixin from "./Mixins/HasAttributesMixin";
|
|
3
|
+
declare class Message {
|
|
4
|
+
protected originContent: string;
|
|
5
|
+
constructor(attributes: Record<string, any>, originContent?: string);
|
|
6
|
+
/**
|
|
7
|
+
* 根据请求内容生成消息对象
|
|
8
|
+
* @param request
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
static createFromRequest(request: ServerRequestInterface): Promise<Message>;
|
|
12
|
+
getOriginalContents(): string;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
interface Message extends HasAttributesMixin {
|
|
16
|
+
/**
|
|
17
|
+
* 消息密文,兼容模式、安全模式才有
|
|
18
|
+
*/
|
|
19
|
+
Encrypt?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 开发者微信号
|
|
22
|
+
*/
|
|
23
|
+
ToUserName?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 发送方帐号 OpenId
|
|
26
|
+
*/
|
|
27
|
+
FromUserName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 消息创建时间
|
|
30
|
+
*/
|
|
31
|
+
CreateTime?: number;
|
|
32
|
+
/**
|
|
33
|
+
* 消息类型,'event':事件,'text':文本,'image':图片,'voice':语音,'video':视频,'shortvideo':小视频,'location':地理位置,'link':链接
|
|
34
|
+
*/
|
|
35
|
+
MsgType?: string;
|
|
36
|
+
/**
|
|
37
|
+
* 消息id,64位整型
|
|
38
|
+
* @scope MsgType='text' | 'image' | 'voice' | 'video' | 'shortvideo' | 'location'
|
|
39
|
+
*/
|
|
40
|
+
MsgId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 文本消息内容
|
|
43
|
+
* @scope MsgType='text'
|
|
44
|
+
*/
|
|
45
|
+
Content?: string;
|
|
46
|
+
/**
|
|
47
|
+
* 图片链接
|
|
48
|
+
* @scope MsgType='image'
|
|
49
|
+
*/
|
|
50
|
+
PicUrl?: string;
|
|
51
|
+
/**
|
|
52
|
+
* 媒体id,可以调用获取临时素材接口拉取数据
|
|
53
|
+
* @scope MsgType='image' | 'voice'
|
|
54
|
+
*/
|
|
55
|
+
MediaId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 语音格式,如amr,speex等
|
|
58
|
+
* @scope MsgType='voice'
|
|
59
|
+
*/
|
|
60
|
+
Format?: string;
|
|
61
|
+
/**
|
|
62
|
+
* 语音识别结果,UTF8编码
|
|
63
|
+
* @scope MsgType='voice'
|
|
64
|
+
*/
|
|
65
|
+
Recognition?: string;
|
|
66
|
+
/**
|
|
67
|
+
* 缩略图的媒体id
|
|
68
|
+
* @scope MsgType='video' | 'shortvideo'
|
|
69
|
+
*/
|
|
70
|
+
ThumbMediaId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 纬度
|
|
73
|
+
* @scope MsgType='location'
|
|
74
|
+
*/
|
|
75
|
+
Location_X?: number;
|
|
76
|
+
/**
|
|
77
|
+
* 经度
|
|
78
|
+
* @scope MsgType='location'
|
|
79
|
+
*/
|
|
80
|
+
Location_Y?: number;
|
|
81
|
+
/**
|
|
82
|
+
* 地图缩放大小
|
|
83
|
+
* @scope MsgType='location'
|
|
84
|
+
*/
|
|
85
|
+
Scale?: number;
|
|
86
|
+
/**
|
|
87
|
+
* 地理位置信息
|
|
88
|
+
* @scope MsgType='location'
|
|
89
|
+
*/
|
|
90
|
+
Label?: number;
|
|
91
|
+
/**
|
|
92
|
+
* 消息标题
|
|
93
|
+
* @scope MsgType='link'
|
|
94
|
+
*/
|
|
95
|
+
Title?: string;
|
|
96
|
+
/**
|
|
97
|
+
* 消息描述
|
|
98
|
+
* @scope MsgType='link'
|
|
99
|
+
*/
|
|
100
|
+
Description?: string;
|
|
101
|
+
/**
|
|
102
|
+
* 消息链接
|
|
103
|
+
* @scope MsgType='link'
|
|
104
|
+
*/
|
|
105
|
+
Url?: string;
|
|
106
|
+
/**
|
|
107
|
+
* 事件类型,subscribe:关注,unsubscribe:取消关注,SCAN:扫描(用户已关注),LOCATION:地理位置;CLICK:自定义菜单事件,VIEW:点击菜单跳转链接
|
|
108
|
+
* @scope MsgType='event'
|
|
109
|
+
*/
|
|
110
|
+
Event?: string;
|
|
111
|
+
/**
|
|
112
|
+
* 事件KEY值
|
|
113
|
+
*
|
|
114
|
+
* Event='subscribe' | 'SCAN'时:qrscene_为前缀,后面为二维码的参数值
|
|
115
|
+
*
|
|
116
|
+
* Event='CLICK'时:自定义菜单接口中KEY值对应
|
|
117
|
+
*
|
|
118
|
+
* Event='VIEW'时:设置的跳转URL
|
|
119
|
+
*
|
|
120
|
+
* @scope MsgType='event' && Event='subscribe' | 'SCAN' | 'CLICK' | 'VIEW'
|
|
121
|
+
*/
|
|
122
|
+
EventKey?: string;
|
|
123
|
+
/**
|
|
124
|
+
* 二维码的ticket,可用来换取二维码图片
|
|
125
|
+
* @scope MsgType='event' && Event='subscribe' | 'SCAN'
|
|
126
|
+
*/
|
|
127
|
+
Ticket?: string;
|
|
128
|
+
/**
|
|
129
|
+
* 纬度
|
|
130
|
+
* @scope MsgType='event' && Event='LOCATION'
|
|
131
|
+
*/
|
|
132
|
+
Latitude?: number;
|
|
133
|
+
/**
|
|
134
|
+
* 经度
|
|
135
|
+
* @scope MsgType='event' && Event='LOCATION'
|
|
136
|
+
*/
|
|
137
|
+
Longitude?: number;
|
|
138
|
+
/**
|
|
139
|
+
* 位置精度
|
|
140
|
+
* @scope MsgType='event' && Event='LOCATION'
|
|
141
|
+
*/
|
|
142
|
+
Precision?: number;
|
|
143
|
+
}
|
|
144
|
+
export = Message;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
const HasAttributesMixin_1 = __importDefault(require("./Mixins/HasAttributesMixin"));
|
|
15
|
+
const Utils_1 = require("./Support/Utils");
|
|
16
|
+
class Message {
|
|
17
|
+
constructor(attributes, originContent = '') {
|
|
18
|
+
this.originContent = '';
|
|
19
|
+
this.attributes = attributes;
|
|
20
|
+
this.originContent = originContent;
|
|
21
|
+
return new Proxy(this, {
|
|
22
|
+
set: function (obj, key, val) {
|
|
23
|
+
if (typeof obj[key] !== 'undefined') {
|
|
24
|
+
obj[key] = val;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
obj.set(key, val);
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
},
|
|
31
|
+
get: function (obj, key) {
|
|
32
|
+
if (typeof obj[key] !== 'undefined') {
|
|
33
|
+
return obj[key];
|
|
34
|
+
}
|
|
35
|
+
return obj.get(key);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 根据请求内容生成消息对象
|
|
41
|
+
* @param request
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
static createFromRequest(request) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
let originContent = request.getBody().toString();
|
|
47
|
+
let attributes = {};
|
|
48
|
+
if ('<' === originContent.substring(0, 1)) {
|
|
49
|
+
attributes = yield (0, Utils_1.parseXml)(originContent);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Handle JSON format.
|
|
53
|
+
try {
|
|
54
|
+
attributes = JSON.parse(originContent);
|
|
55
|
+
}
|
|
56
|
+
catch (e) { }
|
|
57
|
+
}
|
|
58
|
+
if (Object.keys(attributes).length === 0) {
|
|
59
|
+
throw new Error('Failed to decode request contents.');
|
|
60
|
+
}
|
|
61
|
+
return new Message(attributes, originContent);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getOriginalContents() {
|
|
65
|
+
return this.originContent;
|
|
66
|
+
}
|
|
67
|
+
toString() {
|
|
68
|
+
return this.toJson();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
;
|
|
72
|
+
;
|
|
73
|
+
(0, Utils_1.applyMixins)(Message, [HasAttributesMixin_1.default]);
|
|
74
|
+
module.exports = Message;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import CacheInterface from "../Contracts/CacheInterface";
|
|
2
|
+
declare class CacheMixin {
|
|
3
|
+
protected cache: CacheInterface;
|
|
4
|
+
protected cacheLifetime: number;
|
|
5
|
+
protected cacheNamespace: string;
|
|
6
|
+
/**
|
|
7
|
+
* 获取缓存过期时间,单位:秒
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
getCacheLifetime(): number;
|
|
11
|
+
/**
|
|
12
|
+
* 设置缓存过期时间,单位:秒
|
|
13
|
+
* @param cacheLifetime
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
setCacheLifetime(cacheLifetime: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* 获取缓存命名空间
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
getCacheNamespace(): string;
|
|
22
|
+
/**
|
|
23
|
+
* 设置缓存命名空间
|
|
24
|
+
* @param cacheNamespace
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
setCacheNamespace(cacheNamespace: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* 获取缓存实例
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
getCache(): CacheInterface;
|
|
33
|
+
/**
|
|
34
|
+
* 设置缓存实例
|
|
35
|
+
* @param cache
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
setCache(cache: CacheInterface): this;
|
|
39
|
+
}
|
|
40
|
+
export = CacheMixin;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const FileCache_1 = __importDefault(require("../Cache/FileCache"));
|
|
6
|
+
class CacheMixin {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cache = null;
|
|
9
|
+
this.cacheLifetime = 1500;
|
|
10
|
+
this.cacheNamespace = 'easywechat';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 获取缓存过期时间,单位:秒
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getCacheLifetime() {
|
|
17
|
+
return this.cacheLifetime;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 设置缓存过期时间,单位:秒
|
|
21
|
+
* @param cacheLifetime
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
setCacheLifetime(cacheLifetime) {
|
|
25
|
+
this.cacheLifetime = cacheLifetime;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 获取缓存命名空间
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
getCacheNamespace() {
|
|
32
|
+
return this.cacheNamespace;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 设置缓存命名空间
|
|
36
|
+
* @param cacheNamespace
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
setCacheNamespace(cacheNamespace) {
|
|
40
|
+
this.cacheNamespace = cacheNamespace;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 获取缓存实例
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
getCache() {
|
|
47
|
+
if (!this.cache) {
|
|
48
|
+
this.cache = new FileCache_1.default();
|
|
49
|
+
}
|
|
50
|
+
return this.cache;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 设置缓存实例
|
|
54
|
+
* @param cache
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
setCache(cache) {
|
|
58
|
+
this.cache = cache;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
module.exports = CacheMixin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import AccessTokenAwareClient from "../HttpClient/AccessTokenAwareClient";
|
|
2
|
+
declare class ClientMixin {
|
|
3
|
+
protected client: AccessTokenAwareClient;
|
|
4
|
+
/**
|
|
5
|
+
* 获取客户端实例
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
getClient(): AccessTokenAwareClient;
|
|
9
|
+
/**
|
|
10
|
+
* 设置客户端实例
|
|
11
|
+
* @param client
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
setClient(client: AccessTokenAwareClient): this;
|
|
15
|
+
}
|
|
16
|
+
export = ClientMixin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
class ClientMixin {
|
|
3
|
+
/**
|
|
4
|
+
* 获取客户端实例
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
getClient() {
|
|
8
|
+
return this.client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 设置客户端实例
|
|
12
|
+
* @param client
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
setClient(client) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
module.exports = ClientMixin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ConfigInterface from "../Contracts/ConfigInterface";
|
|
2
|
+
declare class ConfigMixin {
|
|
3
|
+
protected config: ConfigInterface;
|
|
4
|
+
/**
|
|
5
|
+
* 获取配置实例
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
getConfig(): ConfigInterface;
|
|
9
|
+
/**
|
|
10
|
+
* 设置配置实例
|
|
11
|
+
* @param config
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
setConfig(config: ConfigInterface): this;
|
|
15
|
+
}
|
|
16
|
+
export = ConfigMixin;
|