Access to client as injectable service

Created on 27 October 2021, over 3 years ago
Updated 19 February 2025, about 2 months ago

Problem/Motivation

I want to be able to use the mailjet API client for calls not related to sending emails, such as list management. I usually expect an API module to expose the full API in a usable fashion.

Steps to reproduce

Try to access client property on MailjetApiHandler - you can't, it's protected (as it should be).

Proposed resolution

MailjetApiHandler handles two separate concerns:

  1. Checking that everything is in place to use the API (library, configuration etc) and initialising the client
  2. Sending emails.

Normally I would suggest that separating these concerns into two separate services would be the best approach, however I think that will cause backwards-compatibility issues... so unless there's appetite for a 2.x version I'd say that adding a getClient() method to the existing service would be enough.

Remaining tasks

  1. Decide on an approach
  2. Patch
  3. Review
  4. Commit

User interface changes

Unlikely.

API changes

Maybe, depends on approach.

Data model changes

None.

Feature request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇦🇺Australia darvanen Sydney, Australia

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024