Make "get" endpoints return objects

Created on 24 October 2023, over 1 year ago

Problem/Motivation

The API manager currently returns the raw json response. Code could be more robust when returning value objects holding common functionality. There would also be a centralised way of checking missing response data and do error handling.
See issue #3394527 📌 Add support for "Interest" endpoints, deprecate "Interest label" endpoints Fixed as example (InterestCollection and Interest object).

Steps to reproduce

Use the FlexmailApiManager and make a call to getContacts(). The method returns the raw response as an array.

Proposed resolution

Create the following value objects to be returned in the associated api methods:

  • FlexmailApiManager::getContacts() returns ContactCollection holding Contact objects
  • FlexmailApiManager::getContactWithEmail() returns ContactCollection holding Contact objects
  • FlexmailApiManager::getCustomFields() returns CustomFieldCollection holding CustomField objects
  • FlexmailApiManager::getSources() returns SourceCollection holding Source objects

For now I didn't add the deprecated endpoints. They might need to be added as well in case they will be supported for a longer time:

  • FlexmailApiManager::getPreferences()
  • FlexmailApiManager::getContactPreferenceSubscriptions()
  • FlexmailApiManager::getInterestLabels()
  • FlexmailApiManager::getContactInterestLabels()

Remaining tasks

See proposed solution.

User interface changes

None

API changes

Yes. See proposed solution.

Data model changes

None

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium fernly

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024