diff --git a/changelog.md b/changelog.md index 5f88fcd..3c09623 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +1.11.1 +------ +- Feat: Support error hooks in plugins #226 #227 +- Fix: Bypass Twitter v2 incoherence by converting `start_time` to a valid `since_id` when `until_id` is used in paginators #197 #228 +- Feat: Getter for DM images `.v1.downloadDmImage` to download images hosted on `ton.twitter.com` protected by OAuth 1.0a + 1.11.0 ------ - Feat: Support plugins (more features coming soon as plugins!) diff --git a/doc/plugins.md b/doc/plugins.md index f8f77fb..3614375 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -28,6 +28,11 @@ interface ITwitterApiClientPlugin { onBeforeRequest?: TTwitterApiBeforeRequestHook /* Executed when a request succeeds (failed requests don't trigger this hook). */ onAfterRequest?: TTwitterApiAfterRequestHook + // Error handling in classic requests + /* Executed when Twitter doesn't reply (network error, server disconnect). */ + onRequestError?: TTwitterApiRequestErrorHook + /* Executed when Twitter reply but with an error? */ + onResponseError?: TTwitterApiResponseErrorHook // Stream requests /* Executed when a stream request is about to be prepared. This method **can't** return a `Promise`. */ onBeforeStreamRequestConfig?: TTwitterApiBeforeStreamRequestConfigHook @@ -46,6 +51,8 @@ Method types: type TTwitterApiBeforeRequestConfigHook = (args: ITwitterApiBeforeRequestConfigHookArgs) => PromiseOrType | void> type TTwitterApiBeforeRequestHook = (args: ITwitterApiBeforeRequestHookArgs) => void | Promise type TTwitterApiAfterRequestHook = (args: ITwitterApiAfterRequestHookArgs) => void | Promise +type TTwitterApiRequestErrorHook = (args: ITwitterApiRequestErrorHookArgs) => void | Promise +type TTwitterApiResponseErrorHook = (args: ITwitterApiResponseErrorHookArgs) => void | Promise type TTwitterApiBeforeStreamRequestConfigHook = (args: ITwitterApiBeforeRequestConfigHookArgs) => void type TTwitterApiAfterOAuth1RequestTokenHook = (args: ITwitterApiAfterOAuth1RequestTokenHookArgs) => void | Promise type TTwitterApiAfterOAuth2RequestTokenHook = (args: ITwitterApiAfterOAuth2RequestTokenHookArgs) => void | Promise diff --git a/package.json b/package.json index f5ab5a9..5c9cf1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "twitter-api-v2", - "version": "1.11.0", + "version": "1.11.1", "description": "Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.", "main": "dist/index.js", "types": "dist/index.d.ts",