CustomObjects.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. namespace OntraportAPI;
  3. /**
  4. * Class CustomObjects
  5. *
  6. * @author ONTRAPORT
  7. *
  8. * @package OntraportAPI
  9. */
  10. class CustomObjects extends Objects
  11. {
  12. public function __construct(Ontraport $client, $object)
  13. {
  14. parent::__construct($client);
  15. $this->_objectID = $object;
  16. }
  17. private $_objectID = NULL;
  18. /**
  19. * @brief Retrieve a single specified object
  20. *
  21. * @param mixed[] $requestParams The parameters to submit with GET request.
  22. * Varies by object.
  23. *
  24. * @return string JSON formatted response
  25. */
  26. public function retrieveSingle($requestParams)
  27. {
  28. $requestParams["objectID"] = $this->_objectID;
  29. return parent::retrieveSingle($requestParams);
  30. }
  31. /**
  32. * @brief Retrieve multiple objects according to specific criteria
  33. *
  34. * @param mixed[] $requestParams Array of parameters to submit with GET request.
  35. * Varies by object.
  36. *
  37. * @return string JSON formatted response.
  38. */
  39. public function retrieveMultiple($requestParams)
  40. {
  41. $requestParams["objectID"] = $this->_objectID;
  42. return parent::retrieveMultiple($requestParams);
  43. }
  44. /**
  45. * @brief Create an object
  46. *
  47. * @param mixed[] $requestParams Array of parameters to submit with POST request.
  48. * Varies by object.
  49. *
  50. * @return string JSON formatted response
  51. */
  52. public function create($requestParams)
  53. {
  54. $requestParams["objectID"] = $this->_objectID;
  55. return parent::create($requestParams);
  56. }
  57. /**
  58. * @brief Delete a single specified object
  59. *
  60. * @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
  61. * Varies by object.
  62. *
  63. * @return string JSON formatted response
  64. */
  65. public function deleteSingle($requestParams)
  66. {
  67. $requestParams["objectID"] = $this->_objectID;
  68. return parent::deleteSingle($requestParams);
  69. }
  70. /**
  71. * @brief Delete multiple objects according to specific criteria
  72. *
  73. * @param mixed[] $requestParams The parameters to submit with DELETE request.
  74. * Varies by object.
  75. *
  76. * @return string JSON formatted response
  77. */
  78. public function deleteMultiple($requestParams)
  79. {
  80. $requestParams["objectID"] = $this->_objectID;
  81. return parent::deleteMultiple($requestParams);
  82. }
  83. /**
  84. * @brief Update an object's data
  85. *
  86. * @param mixed[] $requestParams The parameters to submit with PUT request.
  87. * Varies by object.
  88. *
  89. * @return string JSON formatted response
  90. */
  91. public function update($requestParams)
  92. {
  93. $requestParams["objectID"] = $this->_objectID;
  94. return parent::update($requestParams);
  95. }
  96. /**
  97. * @brief Retrieve meta for a contact object
  98. *
  99. * @return string JSON formatted meta for contact object
  100. */
  101. public function retrieveMeta($requestParams = NULL)
  102. {
  103. $requestParams["objectID"] = $this->_objectID;
  104. return parent::retrieveMeta($requestParams);
  105. }
  106. /**
  107. * @brief Retrieve information (such as number of objects) about a collection
  108. *
  109. * @param mixed[] $requestParams Array of parameters to submit with GET request.
  110. * Varies by object.
  111. *
  112. * @return string JSON formatted response
  113. */
  114. public function retrieveCollectionInfo($requestParams)
  115. {
  116. $requestParams["objectID"] = $this->_objectID;
  117. return parent::retrieveCollectionInfo($requestParams);
  118. }
  119. }