LandingPages.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace OntraportAPI;
  3. /**
  4. * Class LandingPages
  5. *
  6. * @author ONTRAPORT
  7. *
  8. * @package OntraportAPI
  9. */
  10. class LandingPages extends BaseApi
  11. {
  12. /**
  13. * $var string endpoint for single landing page
  14. */
  15. protected $_endpoint = "LandingPage";
  16. /**
  17. * $var string endpoint for plural landing page
  18. */
  19. protected $_endpointPlural = "LandingPages";
  20. /**
  21. * @param Ontraport $client
  22. */
  23. public function __construct(Ontraport $client)
  24. {
  25. parent::__construct($client);
  26. }
  27. /*
  28. * @TODO This is a placeholder, API needs to be revised to follow one standard for endpoint naming
  29. */
  30. private $_mainLandingPageEndpoint = "landingPage";
  31. // Landing Page specific function endpoint
  32. const HOSTED_URL = "getHostedURL";
  33. /**
  34. * @brief Retrieve a single specified landing page
  35. *
  36. * @param mixed[] $requestParams The parameters to submit with GET request.
  37. * Possible array keys: "id" (required)
  38. *
  39. * @return string JSON formatted response
  40. */
  41. public function retrieveSingle($requestParams)
  42. {
  43. return parent::_retrieveSingle($requestParams);
  44. }
  45. /**
  46. * @brief Retrieve multiple landing pages according to specific criteria, handle pagination
  47. *
  48. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
  49. * are not specified, all will be selected.
  50. * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
  51. * "searchNotes","group_ids","performAll","externs","listFields"
  52. *
  53. * @return string JSON formatted array of paginated response data: each page of data will be an element in that array
  54. */
  55. public function retrieveMultiplePaginated($requestParams)
  56. {
  57. return parent::_retrieveMultiplePaginated($requestParams);
  58. }
  59. /**
  60. * @brief Retrieve multiple landing pages according to specific criteria
  61. *
  62. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
  63. * are not specified, all will be selected.
  64. * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
  65. * "searchNotes","group_ids","performAll","externs","listFields"
  66. *
  67. * @return string JSON formatted response
  68. */
  69. public function retrieveMultiple($requestParams)
  70. {
  71. return parent::_retrieveMultiple($requestParams);
  72. }
  73. /**
  74. * @brief Retrieve information (such as number of landing pages) about landing page collection
  75. *
  76. * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
  77. * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
  78. *
  79. * @return string JSON formatted response
  80. */
  81. public function retrieveCollectionInfo($requestParams)
  82. {
  83. return parent::_retrieveCollectionInfo($requestParams);
  84. }
  85. /**
  86. * @brief Retrieve meta for a landing page object
  87. *
  88. * @return string JSON formatted meta for landing page object
  89. */
  90. public function retrieveMeta()
  91. {
  92. return parent::_retrieveMeta();
  93. }
  94. /**
  95. * @brief Retrieve the permanent URL for a landing page.
  96. *
  97. * @param mixed[] $requestParams Array of parameters to submit with GET request.
  98. * Possible array keys: "id" (required)
  99. *
  100. * @return string JSON formatted response
  101. */
  102. public function getHostedURL($requestParams)
  103. {
  104. $requiredParams = array("id");
  105. return $this->client->request($requestParams, $this->_mainLandingPageEndpoint . "/" . self::HOSTED_URL, "get", $requiredParams, $options = NULL);
  106. }
  107. }