@biso_gmbh/capacitor-plugin-rest-information-from-image
v2.0.5
Published
Gets image based information from a REST api that can be configured. The information returned has to be in json format
Readme
capacitor-plugin-rest-information-from-image
Gets image based information from a REST api that can be configured. The information returned has to be in json format, and it only does POST calls. The image will be sent as part of the body as a base64 string, the key is configurable. Also part of the body is the image type, currently hardcoded as jpeg, whose key can also be configured.
[!IMPORTANT]
Version 2.x.x and upwards are Capacitor 6 versions. For Capacitor 5 use version 1.x.x
Install
npm install capacitor-plugin-rest-information-from-image
npx cap syncPublish
To publish to npm use
npm publish --access publicIf this is the first time you publish anything (or you were logged out) use
npm adduser and log in via browser.
API
scan(...)
scan(scanCall: IScanCall) => Promise<object>| Param | Type |
| -------------- | ----------------------------------------------- |
| scanCall | IScanCall |
Returns: Promise<object>
Interfaces
IScanCall
The configuration object for the plugin. IRequest is mandatory because it configures needed things like the url, settings can be left empty, which will use the default settings.
| Prop | Type | Description |
| -------------- | ----------------------------------------------- | ------------------------------------------------------------------- |
| request | IRequest | request configuration |
| settings | ISettings | scanner settings, can be left empty which will use default settings |
IRequest
Data used for the http request. Url, headers and body are required, though both header and body can be an empty object. base64Key and imageTypeKey configure how the image and the image type will be named when they are added to the body.
| Prop | Type | Description |
| ------------------ | --------------------------------------------------------------- | ------------------------------------------------------------- |
| url | string | the url the image will be posted to |
| headers | Record<string, string> | the headers to include, can be an empty object |
| body | Record<string, any> | the body to include, can be an empty object |
| base64Key | string | the key under which the base64 data of the image will be sent |
| imageTypeKey | string | the key under which the image filetype will be sent |
ISettings
All settings that can be passed to the plugin.
| Prop | Type | Description |
| ------------------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| beepOnSuccess | boolean | when true the device will beep on image capture |
| vibrateOnSuccess | boolean | when true the device will vibrate on image capture |
| detectorSize | number | between '0' and '1', determines the percentage of the screen will be covered |
| detectorAspectRatio | string | aspect ratio of the detector in format 2:1 |
| drawFocusRect | boolean | when true the detection area will be outlined |
| focusRectColor | string | color of the detection area outline as hex code (supports alpha) |
| focusRectBorderRadius | number | corner radius of the detection area |
| focusRectBorderThickness | number | border thickness of the detection area outline |
| drawFocusLine | boolean | when true a line will mark the center of the detection area |
| focusLineColor | string | color of the focus line as hex code (supports alpha) |
| focusLineThickness | number | thickness of the focus line |
| drawFocusBackground | boolean | when true the area outside the detector will be filled |
| focusBackgroundColor | string | color to fill the background with as hex code (supports alpha) |
| loadingCircleColor | string | the color of the loading spinner as hex (supports alpha) |
| loadingCircleSize | number | the size of the loading spinner |
| imageWidth | number | image width in px, if width and height are not valid, closest valid size will be used |
| imageHeight | number | image height in px, if width and height are not valid, closest valid size will be used |
| imageCompression | number | image compression, value between '0' and '1', '1' is uncompressed |
| saveImage | boolean | when true the image will be saved to the device |
| imageName | string | prefix of the image name, will be extended with the current date and time |
| androidImageLocation | string | the folder inside the external storage to save the image to on android. needs to be in a folder an app is allowed to work in (eg. Documents/ or Download/). On iOS the folder can't be changed and manually and defaults to 'Documents/<AppName>' |
Type Aliases
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
