Contacts.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. namespace OntraportAPI;
  3. /**
  4. * Class Contacts
  5. *
  6. * @author ONTRAPORT
  7. *
  8. * @package OntraportAPI
  9. */
  10. class Contacts extends BaseApi
  11. {
  12. /**
  13. * $var string endpoint for single contact
  14. */
  15. protected $_endpoint = "Contact";
  16. /**
  17. * $var string endpoint for plural contacts
  18. */
  19. protected $_endpointPlural = "Contacts";
  20. /**
  21. * @param Ontraport $client
  22. */
  23. public function __construct(Ontraport $client)
  24. {
  25. parent::__construct($client);
  26. }
  27. /**
  28. * @brief Retrieve a single specified contact
  29. *
  30. * @param mixed[] $requestParams The parameters to submit with GET request.
  31. * Possible array keys: "id" (required)
  32. *
  33. * @return string JSON formatted response
  34. */
  35. public function retrieveSingle($requestParams)
  36. {
  37. return parent::_retrieveSingle($requestParams);
  38. }
  39. /**
  40. * @brief Retrieve multiple contacts according to specific criteria, handle pagination
  41. *
  42. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
  43. * are not specified, all will be selected.
  44. * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
  45. * "searchNotes","group_ids","performAll","externs","listFields"
  46. *
  47. * @return string JSON formatted array of response data: each page of data will be an element in that array.
  48. */
  49. public function retrieveMultiplePaginated($requestParams)
  50. {
  51. return parent::_retrieveMultiplePaginated($requestParams);
  52. }
  53. /**
  54. * @brief Retrieve multiple contacts according to specific criteria
  55. *
  56. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
  57. * are not specified, all will be selected.
  58. * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
  59. * "searchNotes","group_ids","performAll","externs","listFields"
  60. *
  61. * @return string JSON formatted response
  62. */
  63. public function retrieveMultiple($requestParams)
  64. {
  65. return parent::_retrieveMultiple($requestParams);
  66. }
  67. /**
  68. * @brief Create a contact
  69. *
  70. * @param mixed[] $requestParams Array of parameters to submit with POST request.
  71. * Possible array keys: "firstname","lastname","email","freferrer","lreferrer","address",
  72. * "city","state","zip","birthday","aff_paypal","program_id",
  73. * "bulk_mail","office_phone","fax","company","address2","website",
  74. * "title","country","n_lead_source","n_campaign","n_content",
  75. * "n_content","n_medium","referral_page","num_purchased","owner",
  76. * "bulk_sms","sms_number",{customFields}(if you have custom contact
  77. * fields in your account, these can be included in the array keys)
  78. *
  79. * @return string JSON formatted response
  80. */
  81. public function create($requestParams)
  82. {
  83. return parent::_create($requestParams);
  84. }
  85. /**
  86. * @brief Delete a single specified contact
  87. *
  88. * @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
  89. * Possible array keys: "id" (required)
  90. *
  91. * @return string JSON formatted response
  92. */
  93. public function deleteSingle($requestParams)
  94. {
  95. return parent::_deleteSingle($requestParams);
  96. }
  97. /**
  98. * @brief Delete multiple contacts according to specific criteria
  99. *
  100. * @param mixed[] $requestParams The parameters to submit with DELETE request. All parameters are optional but if "ids"
  101. * are not specified, all will be deleted.
  102. * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
  103. * "searchNotes","group_ids","performAll","externs","listFields"
  104. *
  105. * @return string JSON formatted response
  106. */
  107. public function deleteMultiple($requestParams)
  108. {
  109. return parent::_deleteMultiple($requestParams);
  110. }
  111. /**
  112. * @brief Update a contact's data
  113. *
  114. * @param mixed[] $requestParams The parameters to submit with PUT request.
  115. * Possible array keys: "id" (required),"firstname","lastname","email","freferrer",
  116. * "lreferrer","address","city","state","zip","birthday","aff_paypal",
  117. * "program_id","bulk_mail","office_phone","fax","company","address2",
  118. * "website","title","country","n_lead_source","n_campaign","n_content",
  119. * "n_content","n_medium","referral_page","num_purchased","owner",
  120. * "bulk_sms","sms_number",{customFields}(if you have custom contact
  121. * fields in your account, these can be included in the array keys)
  122. *
  123. * @return string JSON formatted response
  124. */
  125. public function update($requestParams)
  126. {
  127. return parent::_update($requestParams);
  128. }
  129. /**
  130. * @brief Retrieve meta for a contact object
  131. *
  132. * @return string JSON formatted meta for contact object
  133. */
  134. public function retrieveMeta()
  135. {
  136. return parent::_retrieveMeta();
  137. }
  138. /**
  139. * @brief Either create a contact or merge with an existing contact on unique field
  140. *
  141. * @param mixed[] $requestParams The parameters to submit with PUT request.
  142. * Possible array keys: "firstname","lastname","email","freferrer","lreferrer","address",
  143. * "city","state","zip","birthday","aff_paypal","program_id",
  144. * "contact_cat","bulk_mail","office_phone","fax","company",
  145. * "address2","website","title","country","spent","n_lead_source",
  146. * "n_campaign","n_content","n_medium","referral_page","aff_sales",
  147. * "aff_amount","mriInvoiceNum","mriInvoiceTotal","mrcAmount",
  148. * "mrcUnpaid","mrcResult","grade","num_purchased","owner",
  149. * "bulk_sms","sms_number","updateSequence","n_term",{customFields}
  150. * (if you have custom contact fields in your account, these can be
  151. * included in the array keys)
  152. *
  153. * @return string JSON formatted response
  154. */
  155. public function saveOrUpdate($requestParams)
  156. {
  157. return parent::_saveOrUpdate($requestParams);
  158. }
  159. /**
  160. * @brief Retrieve information (such as number of contacts) about contact collection
  161. *
  162. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
  163. * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
  164. *
  165. * @return string JSON formatted response
  166. */
  167. public function retrieveCollectionInfo($requestParams)
  168. {
  169. return parent::_retrieveCollectionInfo($requestParams);
  170. }
  171. }