Skip to content

Commit 3eb34ee

Browse files
Merge pull request #3 from aspose-email-cloud/develop
Develop
2 parents ebe73e0 + 35be020 commit 3eb34ee

File tree

90 files changed

+6453
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6453
-305
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
package-lock.json
3-
dist
3+
dist
4+
.vscode

README.md

Lines changed: 167 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,182 @@
1-
Aspose.Email Cloud is a REST API for creating email archiving applications that work with common email file formats. It lets developers manipulate message formats such as Outlook MSG, EML and MHT files.
1+
# Aspose.Email Cloud SDK for Node.Js [![npm](https://img.shields.io/npm/v/@asposecloud/aspose-email-cloud)](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud) [![License](https://img.shields.io/github/license/aspose-email-cloud/aspose-email-cloud-node)](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud) [![node](https://img.shields.io/node/v/@asposecloud/aspose-email-cloud)](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud) [![types](https://img.shields.io/npm/types/@asposecloud/aspose-email-cloud)](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud)
2+
This repository contains Aspose.Email Cloud SDK for Node.Js source code. This SDK allows you to work with Aspose.Email Cloud REST APIs in your Node.Js applications quickly and easily, with zero initial cost.
23

3-
To use these SDKs, you will need App SID and App Key which can be looked up at [Aspose Cloud Dashboard](https://dashboard.aspose.cloud/#/apps) (free registration in Aspose Cloud is required for this).
4+
[Aspose.Email Cloud home](https://products.aspose.cloud/email/family "Aspose.Email Cloud")
5+
[API Reference](https://apireference.aspose.cloud/email/)
6+
7+
# Key features
8+
9+
Aspose.Email Cloud is a REST API for creating email applications that work with standard email file formats. This SDK:
10+
- Lets developers manipulate different emails’ formats such as Outlook MSG, EML, VCard, and iCalendar files
11+
- Has a built-in email client
12+
- Supports AI functionalities:
13+
- The Business card recognition
14+
- The Name API for parsing and handling personal names
415

516
## How to use the SDK?
6-
The complete source code is available in the GIT repository. You can either directly use it in your project via source code or get [nmpjs distribution](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud) (recommended).
17+
The complete source code is available in the GIT repository.
18+
Use reference documentation, available [here](doc/README.md).
719

8-
### Install Aspose.Email for Cloud via NPM
20+
### Prerequisites
21+
To use this SDK, you need an App SID and an App Key; they can be looked up at [Aspose Cloud Dashboard](https://dashboard.aspose.cloud/#/apps) (it requires free registration in Aspose Cloud for this).
922

23+
### Installation
24+
You can use it directly in your project via the source code or get a [npm package](https://www.npmjs.com/package/@asposecloud/aspose-email-cloud)
1025
From the command line:
1126

1227
npm install @asposecloud/aspose-email-cloud --save
1328

29+
### Usage examples
30+
To use the API, you should create an EmailApi object:
31+
```typescript
32+
var appKey = "Your App Key";
33+
var appSid = "Your App SID";
34+
var api = new EmailApi(appSid, appKey);
35+
```
36+
37+
#### Business cards recognition API
38+
See examples below:
39+
40+
<details open>
41+
<summary>Parse business card images to VCard contact files</summary>
42+
43+
```typescript
44+
var folder = 'some/folder/on/storage';
45+
var storage = 'First Storage'; //Your storage name
46+
var imageData = fs.readFileSync('some/business/card/image/file/on/disk');
47+
var storageFileName = 'someFileName.png'; //Supports different image formats: PNG, JPEG, BMP, TIFF, GIF, etc.
48+
// Upload business card image to storage
49+
await api.uploadFile(new requests.UploadFileRequest(folder + '/' + storageFileName, imageData, storage));
50+
var outFolder = 'some/other/folder/on/storage'; //Business card recognition results will be saved here
51+
await api.createFolder(new requests.CreateFolderRequest(outFolder, storage));
52+
// Call business card recognition action
53+
var result = await api.aiBcrParseStorage(
54+
new requests.AiBcrParseStorageRequest(new models.AiBcrParseStorageRq(
55+
null,
56+
[new models.AiBcrImageStorageFile( //We can process multiple images in one request
57+
true, //the image contains only one business card (you can upload image with multiple cards on it)
58+
new models.StorageFileLocation(storage, folder, storageFileName))],
59+
new models.StorageFolderLocation(storage, outFolder))));
60+
// Get file name from recognition result
61+
var contactFile = result.body.value[0]; //result.body.value can contain multiple files, if we sent multicard images or multiple images
62+
// You can download the VCard file, which produced by the recognition method ...
63+
var contactBinary = await api.downloadFile(new requests.DownloadFileRequest(
64+
contactFile.folderPath + '/' + contactFile.fileName, storage));
65+
// ... and print it to console
66+
console.log(contactBinary.body.toString());
67+
// Also, you can get VCard object properties’ list using Contact API
68+
var contactProperties = await api.getContactProperties(new requests.GetContactPropertiesRequest(
69+
'vcard', contactFile.fileName, contactFile.folderPath, contactFile.storage));
70+
//All VCard’s properties are available as a list. Complex properties are represented as hierarchical structures.
71+
//Let's print all primitive properties’ values:
72+
contactProperties.body.internalProperties
73+
.filter(property => property.type == 'PrimitiveObject')
74+
.map(property => property as models.PrimitiveObject)
75+
.forEach(property =>
76+
console.log('Property name:' + property.name + ' value:' + property.value));
77+
```
78+
</details>
79+
80+
<details>
81+
<summary>Parse images directly, without the using of a storage</summary>
82+
83+
```typescript
84+
//Read image from file and convert it to Base64 string
85+
var imageData = fs.readFileSync('some/business/card/image/file/on/disk').toString('base64');
86+
var result = await api.aiBcrParse(new requests.AiBcrParseRequest(
87+
new models.AiBcrBase64Rq(undefined, [new models.AiBcrBase64Image(true, imageData)])));
88+
//Result contains all recognized VCard objects (only the one in our case)
89+
var contactProperties = result.body.value[0];
90+
//VCard object is available as a list of properties, without any external calls:
91+
contactProperties.internalProperties
92+
.filter(property => property.type == 'PrimitiveObject')
93+
.map(property => property as models.PrimitiveObject)
94+
.forEach(property =>
95+
console.log('Property name:' + property.name + ' value:' + property.value));
96+
```
97+
</details>
98+
99+
#### Name API
100+
See examples below:
101+
<details open>
102+
<summary>Detect a person's gender by name</summary>
103+
104+
```typescript
105+
var result = await api.aiNameGenderize(new requests.AiNameGenderizeRequest('John Cane'));
106+
//the result contains a list of hypothesis about a person's gender.
107+
//all hypothesis include score, so you can use the most scored version, which will be the first in a list:
108+
console.log(result.body.value[0].gender); //prints 'Male'
109+
```
110+
</details>
111+
112+
<details>
113+
<summary>Format person's name using defined format</summary>
114+
115+
```typescript
116+
var result = await api.aiNameFormat(new requests.AiNameFormatRequest(
117+
'Mr. John Michael Cane', undefined, undefined, undefined, undefined, '%t%L%f%m'));
118+
console.log(result.body.name); //prints 'Mr. Cane J. M.'
119+
```
120+
</details>
121+
122+
<details>
123+
<summary>Compare the names to find out if they belong to the same person or not</summary>
124+
125+
```typescript
126+
var first = 'John Michael Cane';
127+
var second = 'Cane J.';
128+
var result = await api.aiNameMatch(new requests.AiNameMatchRequest(
129+
first, second));
130+
console.log(result.body.similarity > 0.5); //prints 'true', names look similar
131+
```
132+
</details>
133+
134+
<details>
135+
<summary>Expand a person's name into a list of possible alternatives</summary>
136+
137+
```typescript
138+
var result = await api.aiNameExpand(new requests.AiNameExpandRequest(
139+
'Smith Bobby'));
140+
var names = result.body.names
141+
.map(weighted => weighted.name)
142+
.forEach(name => console.log(name)); //prints 'Mr. Smith', 'B. Smith', etc.
143+
```
144+
</details>
145+
146+
<details>
147+
<summary>Get k most probable names for given starting characters</summary>
148+
149+
```typescript
150+
var prefix = 'Dav';
151+
var result = await api.aiNameComplete(new requests.AiNameCompleteRequest(
152+
prefix));
153+
var names = result.body.names
154+
.map(weighted => prefix + weighted.name)
155+
.forEach(name => console.log(name)); //prints 'David', 'Dave', 'Davis', etc.
156+
```
157+
</details>
158+
159+
<details>
160+
<summary>Parse out a person's name from an email address.</summary>
161+
162+
```typescript
163+
var result = await api.aiNameParseEmailAddress(new requests.AiNameParseEmailAddressRequest(
164+
'john-cane@gmail.com'));
165+
var extractedValues = result.body.value
166+
.map(extracted => extracted.name)
167+
.reduce((accumulator, value) => accumulator.concat(value));
168+
var givenName = extractedValues.find(extracted => extracted.category == 'GivenName');
169+
var surname = extractedValues.find(extracted => extracted.category == 'Surname');
170+
console.log(givenName.value); // 'John'
171+
console.log(surname.value); // 'Cane'
172+
```
173+
</details>
174+
14175
# Licensing
15-
All Aspose.Email for Cloud SDKs, helper scripts and templates are licensed under [MIT License](LICENSE).
176+
All Aspose.Email Cloud SDKs, helper scripts and templates are licensed under [MIT License](LICENSE).
16177

17178
# Resources
179+
+ [**SDK reference documentation**](doc/README.md)
18180
+ [**Website**](https://www.aspose.cloud)
19181
+ [**Product Home**](https://products.aspose.cloud/Email/cloud)
20182
+ [**Documentation**](https://docs.aspose.cloud/display/Emailcloud/Home)

doc/AccountBaseRequest.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# AccountBaseRequest
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**firstAccount** | **string** | First account storage file name for receiving emails (or universal one) | [default to undefined]
8+
**secondAccount** | **string** | Second account storage file name for sending emails (ignored if first is universal) | [optional] [default to undefined]
9+
**storageFolder** | [**StorageFolderLocation**](StorageFolderLocation.md) | Storage folder location of account files | [optional] [default to undefined]
10+
11+
12+
13+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AddAttachmentRequest.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# AddAttachmentRequest
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**documentFolder** | [**StorageFolderLocation**](StorageFolderLocation.md) | Storage folder location of document | [optional] [default to undefined]
8+
**attachmentFolder** | [**StorageFolderLocation**](StorageFolderLocation.md) | Storage folder location of an attachment | [optional] [default to undefined]
9+
10+
11+
12+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrBase64Image.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# AiBcrBase64Image
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**base64Data** | **string** | Image data in base64 | [optional] [default to undefined]
8+
9+
Parent class: [AiBcrImage](AiBcrImage.md)
10+
11+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrBase64Rq.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# AiBcrBase64Rq
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**images** | [**Array&lt;AiBcrBase64Image&gt;**](AiBcrBase64Image.md) | Images to recognize | [optional] [default to undefined]
8+
9+
Parent class: [AiBcrRq](AiBcrRq.md)
10+
11+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrImage.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# AiBcrImage
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**isSingle** | **boolean** | Determines that image contains single VCard or more. Ignored in current version. Multiple cards on image support will be added soon | [default to undefined]
8+
9+
10+
11+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrImageStorageFile.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# AiBcrImageStorageFile
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**file** | [**StorageFileLocation**](StorageFileLocation.md) | Image location | [optional] [default to undefined]
8+
9+
Parent class: [AiBcrImage](AiBcrImage.md)
10+
11+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrOcrData.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
# AiBcrOcrData
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**id** | **string** | Image identifier | [optional] [default to undefined]
8+
**image** | **string** | Image with possible pre-processing in Base64 | [optional] [default to undefined]
9+
**details** | **{ [key: string]: string; }** | Additional details from OCR engine | [optional] [default to undefined]
10+
**data** | [**Array&lt;AiBcrOcrDataPart&gt;**](AiBcrOcrDataPart.md) | OCR results | [optional] [default to undefined]
11+
12+
13+
14+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

doc/AiBcrOcrDataPart.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
# AiBcrOcrDataPart
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**x** | **number** | X position of text block | [default to undefined]
8+
**y** | **number** | Y position of text block | [default to undefined]
9+
**width** | **number** | Width of text block | [default to undefined]
10+
**height** | **number** | Height of text block | [default to undefined]
11+
**text** | **string** | Recognized text | [optional] [default to undefined]
12+
**details** | **{ [key: string]: string; }** | Additional recognition result details | [optional] [default to undefined]
13+
14+
15+
16+
[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

0 commit comments

Comments
 (0)