Skip to content

Commit

Permalink
Feat: Added events and track identify api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
homewardgamer committed Nov 20, 2024
1 parent 0fe25aa commit 810486b
Show file tree
Hide file tree
Showing 33 changed files with 2,696 additions and 29 deletions.
27 changes: 27 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,41 @@ docs/Contact.md
docs/ContactApi.md
docs/ContactRequest.md
docs/CreateResponse.md
docs/CustomEventRequest.md
docs/DashboardStats.md
docs/DeleteCampaign200Response.md
docs/DeleteRequest.md
docs/DeleteResponse.md
docs/EventApi.md
docs/EventResponse.md
docs/GettingStartedApi.md
docs/IdentifyRequest.md
docs/IdentifyResponse.md
docs/LastSentCampaignStat.md
docs/ListApi.md
docs/ListModel.md
docs/ListRequest.md
docs/ReportData.md
docs/ReportsApi.md
docs/Response.md
docs/RevenueEventRequest.md
docs/Sender.md
docs/SenderApi.md
docs/SenderRequest.md
docs/SenderResponse.md
docs/Tag.md
docs/TagRequest.md
docs/TagsApi.md
docs/TrackRequest.md
docs/TrackResponse.md
git_push.sh
mocha.opts
package.json
src/sendx/ApiClient.js
src/sendx/api/CampaignApi.js
src/sendx/api/ContactApi.js
src/sendx/api/EventApi.js
src/sendx/api/GettingStartedApi.js
src/sendx/api/ListApi.js
src/sendx/api/ReportsApi.js
src/sendx/api/SenderApi.js
Expand All @@ -45,17 +56,33 @@ src/sendx/model/CampaignRequest.js
src/sendx/model/Contact.js
src/sendx/model/ContactRequest.js
src/sendx/model/CreateResponse.js
src/sendx/model/CustomEventRequest.js
src/sendx/model/DashboardStats.js
src/sendx/model/DeleteCampaign200Response.js
src/sendx/model/DeleteRequest.js
src/sendx/model/DeleteResponse.js
src/sendx/model/EventResponse.js
src/sendx/model/IdentifyRequest.js
src/sendx/model/IdentifyResponse.js
src/sendx/model/LastSentCampaignStat.js
src/sendx/model/ListModel.js
src/sendx/model/ListRequest.js
src/sendx/model/ReportData.js
src/sendx/model/Response.js
src/sendx/model/RevenueEventRequest.js
src/sendx/model/Sender.js
src/sendx/model/SenderRequest.js
src/sendx/model/SenderResponse.js
src/sendx/model/Tag.js
src/sendx/model/TagRequest.js
src/sendx/model/TrackRequest.js
src/sendx/model/TrackResponse.js
test/sendx/api/EventApi.spec.js
test/sendx/api/GettingStartedApi.spec.js
test/sendx/model/CustomEventRequest.spec.js
test/sendx/model/EventResponse.spec.js
test/sendx/model/IdentifyRequest.spec.js
test/sendx/model/IdentifyResponse.spec.js
test/sendx/model/RevenueEventRequest.spec.js
test/sendx/model/TrackRequest.spec.js
test/sendx/model/TrackResponse.spec.js
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ Class | Method | HTTP request | Description
*sendx.CampaignApi* | [**getAllCampaigns**](docs/CampaignApi.md#getAllCampaigns) | **GET** /campaign | Get All Campaigns
*sendx.CampaignApi* | [**getCampaignById**](docs/CampaignApi.md#getCampaignById) | **GET** /campaign/{campaignId} | Get Campaign By Id
*sendx.ContactApi* | [**createContact**](docs/ContactApi.md#createContact) | **POST** /contact | Create a contact
*sendx.ContactApi* | [**deleteContact**](docs/ContactApi.md#deleteContact) | **DELETE** /contact/{contactId} | Delete Contact
*sendx.ContactApi* | [**deleteContact**](docs/ContactApi.md#deleteContact) | **DELETE** /contact/{identifier} | Delete Contact
*sendx.ContactApi* | [**getAllContacts**](docs/ContactApi.md#getAllContacts) | **GET** /contact | Get All Contacts
*sendx.ContactApi* | [**getContactById**](docs/ContactApi.md#getContactById) | **GET** /contact/{contactId} | Get Contact by ID
*sendx.ContactApi* | [**unsubscribeContact**](docs/ContactApi.md#unsubscribeContact) | **POST** /contact/unsubscribe/{contactId} | Unsubscribe Contact
*sendx.ContactApi* | [**updateContact**](docs/ContactApi.md#updateContact) | **PUT** /contact/{contactId} | Update Contact
*sendx.ContactApi* | [**getContactById**](docs/ContactApi.md#getContactById) | **GET** /contact/{identifier} | Get Contact by Identifier
*sendx.ContactApi* | [**unsubscribeContact**](docs/ContactApi.md#unsubscribeContact) | **POST** /contact/unsubscribe/{identifier} | Unsubscribe Contact
*sendx.ContactApi* | [**updateContact**](docs/ContactApi.md#updateContact) | **PUT** /contact/{identifier} | Update Contact
*sendx.EventApi* | [**createRevenueEvent**](docs/EventApi.md#createRevenueEvent) | **POST** /events/revenue | Record a revenue event for a specific contact
*sendx.EventApi* | [**pushCustomEvent**](docs/EventApi.md#pushCustomEvent) | **POST** /events/custom | Push a custom event associated with a contact
*sendx.GettingStartedApi* | [**identifyContact**](docs/GettingStartedApi.md#identifyContact) | **POST** /contact/identify | Identify contact
*sendx.GettingStartedApi* | [**trackingContact**](docs/GettingStartedApi.md#trackingContact) | **POST** /contact/track | Add Tracking info
*sendx.ListApi* | [**createList**](docs/ListApi.md#createList) | **POST** /list | Create List
*sendx.ListApi* | [**deleteList**](docs/ListApi.md#deleteList) | **DELETE** /list/{listId} | Delete List
*sendx.ListApi* | [**getAllLists**](docs/ListApi.md#getAllLists) | **GET** /list | Get All Lists
Expand All @@ -120,20 +124,27 @@ Class | Method | HTTP request | Description
- [sendx.Contact](docs/Contact.md)
- [sendx.ContactRequest](docs/ContactRequest.md)
- [sendx.CreateResponse](docs/CreateResponse.md)
- [sendx.CustomEventRequest](docs/CustomEventRequest.md)
- [sendx.DashboardStats](docs/DashboardStats.md)
- [sendx.DeleteCampaign200Response](docs/DeleteCampaign200Response.md)
- [sendx.DeleteRequest](docs/DeleteRequest.md)
- [sendx.DeleteResponse](docs/DeleteResponse.md)
- [sendx.EventResponse](docs/EventResponse.md)
- [sendx.IdentifyRequest](docs/IdentifyRequest.md)
- [sendx.IdentifyResponse](docs/IdentifyResponse.md)
- [sendx.LastSentCampaignStat](docs/LastSentCampaignStat.md)
- [sendx.ListModel](docs/ListModel.md)
- [sendx.ListRequest](docs/ListRequest.md)
- [sendx.ReportData](docs/ReportData.md)
- [sendx.Response](docs/Response.md)
- [sendx.RevenueEventRequest](docs/RevenueEventRequest.md)
- [sendx.Sender](docs/Sender.md)
- [sendx.SenderRequest](docs/SenderRequest.md)
- [sendx.SenderResponse](docs/SenderResponse.md)
- [sendx.Tag](docs/Tag.md)
- [sendx.TagRequest](docs/TagRequest.md)
- [sendx.TrackRequest](docs/TrackRequest.md)
- [sendx.TrackResponse](docs/TrackResponse.md)


## Documentation for Authorization
Expand Down
44 changes: 22 additions & 22 deletions docs/ContactApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ All URIs are relative to *https://api.sendx.io/api/v1/rest*
Method | HTTP request | Description
------------- | ------------- | -------------
[**createContact**](ContactApi.md#createContact) | **POST** /contact | Create a contact
[**deleteContact**](ContactApi.md#deleteContact) | **DELETE** /contact/{contactId} | Delete Contact
[**deleteContact**](ContactApi.md#deleteContact) | **DELETE** /contact/{identifier} | Delete Contact
[**getAllContacts**](ContactApi.md#getAllContacts) | **GET** /contact | Get All Contacts
[**getContactById**](ContactApi.md#getContactById) | **GET** /contact/{contactId} | Get Contact by ID
[**unsubscribeContact**](ContactApi.md#unsubscribeContact) | **POST** /contact/unsubscribe/{contactId} | Unsubscribe Contact
[**updateContact**](ContactApi.md#updateContact) | **PUT** /contact/{contactId} | Update Contact
[**getContactById**](ContactApi.md#getContactById) | **GET** /contact/{identifier} | Get Contact by Identifier
[**unsubscribeContact**](ContactApi.md#unsubscribeContact) | **POST** /contact/unsubscribe/{identifier} | Unsubscribe Contact
[**updateContact**](ContactApi.md#updateContact) | **PUT** /contact/{identifier} | Update Contact



Expand Down Expand Up @@ -65,7 +65,7 @@ Name | Type | Description | Notes

## deleteContact

> Response deleteContact(contactId)
> Response deleteContact(identifier)
Delete Contact

Expand All @@ -83,8 +83,8 @@ apiKeyAuth.apiKey = 'YOUR API KEY';
//apiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new sendx.ContactApi();
let contactId = "contactId_example"; // String | The Contact ID to delete
apiInstance.deleteContact(contactId).then((data) => {
let identifier = "identifier_example"; // String | The Contact ID/ Email to delete
apiInstance.deleteContact(identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
Expand All @@ -97,7 +97,7 @@ apiInstance.deleteContact(contactId).then((data) => {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**contactId** | **String**| The Contact ID to delete |
**identifier** | **String**| The Contact ID/ Email to delete |

### Return type

Expand Down Expand Up @@ -173,11 +173,11 @@ Name | Type | Description | Notes

## getContactById

> Contact getContactById(contactId)
> Contact getContactById(identifier)
Get Contact by ID
Get Contact by Identifier

Retrieve a specific contact by its contactId.
Retrieve a specific contact by its identifier.

### Example

Expand All @@ -191,8 +191,8 @@ apiKeyAuth.apiKey = 'YOUR API KEY';
//apiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new sendx.ContactApi();
let contactId = "sendxid123"; // String | The ID of the contact to retrieve.
apiInstance.getContactById(contactId).then((data) => {
let identifier = "john@doe.com"; // String | The ID or Email of the contact to retrieve.
apiInstance.getContactById(identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
Expand All @@ -205,7 +205,7 @@ apiInstance.getContactById(contactId).then((data) => {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**contactId** | **String**| The ID of the contact to retrieve. |
**identifier** | **String**| The ID or Email of the contact to retrieve. |

### Return type

Expand All @@ -223,7 +223,7 @@ Name | Type | Description | Notes

## unsubscribeContact

> Response unsubscribeContact(contactId)
> Response unsubscribeContact(identifier)
Unsubscribe Contact

Expand All @@ -241,8 +241,8 @@ apiKeyAuth.apiKey = 'YOUR API KEY';
//apiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new sendx.ContactApi();
let contactId = "sendx123"; // String | The Contact ID to unsubscribe
apiInstance.unsubscribeContact(contactId).then((data) => {
let identifier = "sendx123"; // String | The Contact ID or email to unsubscribe
apiInstance.unsubscribeContact(identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
Expand All @@ -255,7 +255,7 @@ apiInstance.unsubscribeContact(contactId).then((data) => {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**contactId** | **String**| The Contact ID to unsubscribe |
**identifier** | **String**| The Contact ID or email to unsubscribe |

### Return type

Expand All @@ -273,7 +273,7 @@ Name | Type | Description | Notes

## updateContact

> Contact updateContact(contactRequest, contactId)
> Contact updateContact(contactRequest, identifier)
Update Contact

Expand All @@ -292,8 +292,8 @@ apiKeyAuth.apiKey = 'YOUR API KEY';

let apiInstance = new sendx.ContactApi();
let contactRequest = new sendx.ContactRequest(); // ContactRequest |
let contactId = "sendxid123"; // String | The ID of the Contact to update
apiInstance.updateContact(contactRequest, contactId).then((data) => {
let identifier = "sendxid123"; // String | The ID or email of the Contact to update
apiInstance.updateContact(contactRequest, identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
Expand All @@ -307,7 +307,7 @@ apiInstance.updateContact(contactRequest, contactId).then((data) => {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**contactRequest** | [**ContactRequest**](ContactRequest.md)| |
**contactId** | **String**| The ID of the Contact to update |
**identifier** | **String**| The ID or email of the Contact to update |

### Return type

Expand Down
12 changes: 12 additions & 0 deletions docs/CustomEventRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# sendx.CustomEventRequest

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Name of the custom event (e.g., 'abandoned_cart'). |
**identifier** | **String** | Unique identifier for the contact (e.g., contact's email). |
**data** | **{String: String}** | Map of property-value pairs associated with the event, where both key and value are strings. |
**time** | **Number** | Unix timestamp of when the event occurred. |


110 changes: 110 additions & 0 deletions docs/EventApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# sendx.EventApi

All URIs are relative to *https://api.sendx.io/api/v1/rest*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createRevenueEvent**](EventApi.md#createRevenueEvent) | **POST** /events/revenue | Record a revenue event for a specific contact
[**pushCustomEvent**](EventApi.md#pushCustomEvent) | **POST** /events/custom | Push a custom event associated with a contact



## createRevenueEvent

> EventResponse createRevenueEvent(revenueEventRequest)
Record a revenue event for a specific contact

Records a revenue event, which can be attributed to campaigns, drips, workflows, or other sources of user interaction.

### Example

```javascript
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: apiKeyAuth
let apiKeyAuth = defaultClient.authentications['apiKeyAuth'];
apiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new sendx.EventApi();
let revenueEventRequest = new sendx.RevenueEventRequest(); // RevenueEventRequest |
apiInstance.createRevenueEvent(revenueEventRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});

```

### Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**revenueEventRequest** | [**RevenueEventRequest**](RevenueEventRequest.md)| |

### Return type

[**EventResponse**](EventResponse.md)

### Authorization

[apiKeyAuth](../README.md#apiKeyAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json


## pushCustomEvent

> EventResponse pushCustomEvent(customEventRequest)
Push a custom event associated with a contact

Pushes a custom event with properties and values for a specified contact.

### Example

```javascript
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: apiKeyAuth
let apiKeyAuth = defaultClient.authentications['apiKeyAuth'];
apiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new sendx.EventApi();
let customEventRequest = new sendx.CustomEventRequest(); // CustomEventRequest |
apiInstance.pushCustomEvent(customEventRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});

```

### Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**customEventRequest** | [**CustomEventRequest**](CustomEventRequest.md)| |

### Return type

[**EventResponse**](EventResponse.md)

### Authorization

[apiKeyAuth](../README.md#apiKeyAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

11 changes: 11 additions & 0 deletions docs/EventResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# sendx.EventResponse

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**eventId** | **String** | Unique identifier for the created event. | [optional]
**status** | **String** | Status of the event creation (e.g., 'success'). | [optional]
**message** | **String** | Additional message about the event creation. | [optional]


Loading

0 comments on commit 810486b

Please sign in to comment.