Use Mixin
Barktler supports mixin; see Barktler Mixin Modules for an official supported mixin list.
Usage
For Debug Logging, add the @barktler/mixin-debug-log
package from npm.
yarn add @barktler/mixin-debug-log
# Or
npm install @barktler/mixin-debug-log --save
Use it is very simple; consider the following API call.
import { createMixinDebugLog } from "@barktler/mixin-debug-log";
const api: GoogleSearchAPI = GoogleSearchAPI.create();
api.useMixin(createMixinDebugLog());
api.search("hello").then(() => /*Do Nothing*/); // The request and response will logged into console
For Verify, add the @barktler/mixin-verify
package from npm.
yarn add @barktler/mixin-verify
# Or
npm install @barktler/mixin-verify --save
Use it is also very simple; consider the following API call.
import { createStringedVerifyMixin } from "@barktler/mixin-verify";
const api: GoogleSearchAPI = GoogleSearchAPI.create();
api.useMixin(createStringedVerifyMixin());
api.search("hello"); // Will Verify request body and response data
Global Mixin
For global mixin usage, see Global Mixin.
Next
Enjoy Barktler!