1.0.1 • Published 7 years ago

huddle_ai v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
7 years ago

CircleCI

huddle_ai

JavaScript client for Huddle AI. This module provide programmatic access to read and write Huddle AI data. Examples and interactive console below. Please contact tech@huddle.ai with any feedback/questions. View further documation of the REST API at https://docs.huddle.ai

  • API version: 1.0.0

Installation

npm

Install it via:

npm install huddle_ai --save

Getting Started

Please follow the installation instruction and execute the following JS code:

var Huddle_Ai = require('huddle_ai');

var defaultClient = Huddle_Ai.ApiClient.instance;

// Configure API key authorization
var UserSecurity = defaultClient.authentications['UserSecurity'];

UserSecurity.apiKey = "YOUR API KEY"

var api = new Huddle_Ai.DefaultApi()

var parameters = {}

var parameters.email = "example@gmail.com";

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:',response.statusCode);
        if(response.statusCode == 200){
		//print the array of people
		console.log(response.body.data)
	}
  }
};
api.peopleGet(parameters,callback);

HuddleAi.DefaultApi

All URIs are relative to https://api.huddle.ai/api/2017_01_23

MethodHTTP requestDescription
peopleCommentIdPostPOST /people/comment/{id}Add a comment to the person
peopleDeleteFileDeleteDELETE /people/delete/fileDelete a file associated with a person
peopleDeletePropertyDeleteDELETE /people/delete/propertyDelete a property associated with a person
peopleGetGET /peopleSearch for a person using query parameters. At least one parameter must be specified
peoplePostPOST /peopleUpdate a person's data
peopleUploadFileIdPostPOST /people/upload/file/{id}Upload file that will be associated to the person with matching id

peopleGet

peopleGet(opts)

Search for a person using query parameters. At least one parameter must be specified

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var opts = { 
  'email': "email_example", // String | The valid email address of the person
  'first_name': "first_name_example", // String | The person's first name
  'last_name': "last_name_example", // String | The person's last name
  'bio': "bio_example", // String | Biography of person
  'twitter': "twitter_example", // String | Twitter handle
  'ethnicity': "ethnicity_example", // String | The ethnicity of the person.
  'gender': "gender_example", // String | The gender of the person.
  'race': "race_example", // String | The race of the person.
  'tags': ["tags_example"], // [String] | The tag(s) associated with the person seperated by commas
  'full_address': "full_address_example", // String | Location of person
  'city': "city_example", // String | Full city name (e.g. \"New York\" not \"NYC\")
  'state': "state_example", // String | Two character state code
  'country': "country_example", // String | ISO 3166-1 alpha-2 two-letter country codes (http://www.nationsonline.org/oneworld/country_code_list.htm)
  'social_handle': "social_handle_example", // String | Social network and social media handle seperated by colon ie twitter,twitter_handle
  'social_url': "social_url_example", // String | Social network and social media url seperated by a comma ie twitter,https://twitter.com/twitter_handle
  'twitter_handle': "twitter_handle_example" // String | The person's twitter handle
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:',response.statusCode);
        if(response.statusCode == 200){
		//print the array of people
		console.log(response.body.data)
	}
  }
};
api.peopleGet(opts, callback);

Parameters

NameTypeDescriptionNotes
emailStringThe valid email address of the personrequired
first_nameStringThe person's first nameoptional
last_nameStringThe person's last nameoptional
bioStringBiography of personoptional
twitterStringTwitter handleoptional
ethnicityStringThe ethnicity of the person.optional
genderStringThe gender of the person.optional
raceStringThe race of the person.optional
tagsStringThe tag(s) associated with the person seperated by commasoptional
full_addressStringLocation of personoptional
cityStringFull city name (e.g. \"New York\" not \"NYC\")optional
stateStringTwo character state codeoptional
countryStringISO 3166-1 alpha-2 two-letter country codes (http://www.nationsonline.org/oneworld/country_code_list.htm)optional
social_handleStringSocial network and social media handle seperated by colon ie twitter,twitter_handleoptional
social_urlStringSocial network and social media url seperated by a comma ie twitter,https://twitter.com/twitter_handleoptional
twitter_handleStringThe person's twitter handleoptional

Return type

PeopleArray

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

peoplePost

People peoplePost(updateParameters)

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var updateParameters = new Huddle_Ai.UpdatePerson(); // UpdatePerson | Update person parameters

updateParameters.email = "example@gmail.com";

updateParameters.bio = "CEO of Huddle AI";

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:' + response.statusCode);
        if(response.statusCode == 200){
		//print the updated person information
		console.log(response.body)
	}
  }
};
api.peoplePost(updateParameters, callback);

Parameters

NameTypeDescriptionNotes
avatarURLA link to the image of the personoptional
add_aliasStringAnother email address associated with the personoptional
emailStringEmail address of the person to updaterequired
bioStringThe person's biographyoptional
cityStringFull city name (e.g. \"New York\" not \"NYC\")optional
countryStringISO 3166-1 alpha-2 two-letter country codes http://www.nationsonline.org/oneworld/country_code_list.htmoptional
delete_tagsStringComma seperate list of tags to delete from the personoptional
ethnicityStringPerson's ethnicityoptional
first_nameStringPerson's first nameoptional
full_addressStringPerson's full addressoptional
genderStringPerson's genderoptional
huddleStringHuddle data can be modified using the huddle parameter. The value is a valid JSON string with special key "Partner_URL" equal to the user's Partner URL required. Use the optional key "overwrite" to replace the existing object ie {"Partner_URL":"http://partner_url","overwrite":"true","Favorite_Movie":"Bad Boys"}optional
last_nameStringPerson's family nameoptional
linkURLA webstie associate with the personoptional
raceStringPerson's raceoptional
remove_aliasStringRemove email address associated with the personoptional
social_handleStringSocial media network and handle to change seperated by a colon ie twitter,twitterhandleoptional
social_urlStringSocial media network and url to change seperated by a comma ie twitter,http://twitter.com/twitterhandleoptional
stateStringPerson's home state (For United States of America use 2 character state code)optional
tagsStringComma seperate list of tags to associate with the personoptional
websiteURLPerson's personal websiteoptional

Ethnicity

  • hispanic

  • non_hispanic

Gender

  • male

  • female

Race

  • american_indian

  • alaska_native

  • asian

  • black

  • native_hawaiian

  • white

Return type

Person

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

peopleCommentIdPost

peopleCommentIdPost(id, commentParameters)

Add a comment to the person's page

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var id = "id_example"; // String | The valid email address of the person you would like to comment on

var commentParameters = new HuddleAiDocumentation.CommentParameters(); // CommentParameters | Comment parameters

commentParameters.email = "example@gmail.com";

commentParameters.comment = "Hello World!";

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:',response.statusCode);
  }
};
api.peopleCommentPost(commentParameters, callback);

Parameters

NameTypeDescriptionNotes
emailStringThe valid email address of the person you would like to comment onrequired
commentStringYour Commentrequired

Return type

SuccessResponse

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

peopleUploadFileIdPost

peopleUploadFileIdPost(id, file)

Upload file that will be associated to the person with matching id

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var email = "example@gmail.com"; // String | The valid email address of the person you want to associate with the file

var file = "/path/to/file.txt"; // File | 

var fs = require('fs');

var data = fs.createReadStream(file)

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:',response.statusCode);
  }
};
api.peopleUploadFileIdPost(email, data, callback);

Parameters

NameTypeDescriptionNotes
emailStringThe valid email address of the person you want to associate with the filerequired
fileFilefs ReadStreamrequired

Return type

SuccessResponse

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

peopleDeleteFileDelete

peopleDeleteFileDelete(deleteParameters)

Delete a file associated with a person

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var deleteParameters = new Huddle_Ai.DeleteFile(); // DeleteFile | 

deleteParameters.Huddle_Ai = "File URL";

deleteParameters.email = "adrian.huddle.ai";

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully with status:',response.statusCode);
  }
};
api.peopleDeleteFileDelete(deleteParameters, callback);

Parameters

NameTypeDescriptionNotes
emailStringEmail address of person associated with the filerequired
urlStringFile URLrequired

Return type

SuccessResponse

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

peopleDeletePropertyDelete

peopleDeletePropertyDelete(deleteParameters)

Delete a property associated with a person

Example

var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;

// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';

var api = new Huddle_Ai.DefaultApi();

var deleteParameters = new Huddle_Ai.DeleteFile(); // 

deleteParameters.Huddle_Ai = "Property File URL";

deleteParameters.email = "adrian.huddle.ai";

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.peopleDeletePropertyDelete(deleteParameters, callback);

Parameters

NameTypeDescriptionNotes
emailStringEmail address of person associated with the filerequired
urlStringFile URLrequired

Return type

SuccessResponse

Authorization

UserSecurity

HTTP request headers

  • Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
  • Accept: application/json

Documentation for Authorization

UserSecurity

  • Type: API key
  • API key parameter name: x-auth-token
  • Location: HTTP header
1.0.1

7 years ago

1.0.0

7 years ago