Skip to content

feat(contact): add support for customer contacts#813

Open
bclerc wants to merge 3 commits into
fastly:mainfrom
bclerc:feat/customer-contacts
Open

feat(contact): add support for customer contacts#813
bclerc wants to merge 3 commits into
fastly:mainfrom
bclerc:feat/customer-contacts

Conversation

@bclerc
Copy link
Copy Markdown

@bclerc bclerc commented May 22, 2026

Change summary

Adds support for the customer contacts API under /customer/{customer_id}/contacts.

Three new client methods:

  • Client.ListContacts
  • Client.CreateContact
  • Client.DeleteContact

The endpoint uses JSON:API with the customer_contact resource type. The Fastly API does not expose an update endpoint for contacts, so only list/create/delete are implemented.

The integration test creates a guard contact first because the API refuses to delete the last contact of a given type (You cannot remove the last <type> contact).

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  • Does your submission pass tests?

User Impact

Users can now manage customer-level contacts (primary, billing, technical, security, emergency) through the Go client instead of having to call the API directly. This unblocks support for customer contacts in the Terraform provider.

Are there any considerations that need to be addressed for release?

No breaking changes. New surface only.

Adds Client.ListContacts, Client.CreateContact, and Client.DeleteContact
backed by /customer/{customer_id}/contacts. The endpoint uses JSON:API
with the customer_contact resource type. The Fastly API does not expose
an update endpoint for contacts, so only list/create/delete are
implemented.

Includes VCR fixtures and validation tests for missing required inputs.
@bclerc bclerc requested a review from a team as a code owner May 22, 2026 13:08
@bclerc bclerc requested a review from kpfleming May 22, 2026 13:08
@kpfleming
Copy link
Copy Markdown
Member

Thanks for the PR! Unfortunately we are no longer adding API endpoints to the top-level fastly package unless they belong there because there are existing endpoints for the same resource type. Since this is a new resource type, it will need to be put into fastly/customer/contacts - refer to fastly/apisecurity/operations for an example of how this is done.

@bclerc
Copy link
Copy Markdown
Author

bclerc commented May 22, 2026

Thanks for the quick review and for pointing me to the right pattern! I'll move the new endpoints into a dedicated fastly/customer/contacts sub-package and use fastly/apisecurity/operations as the reference. I'll push the refactor shortly.

Per review feedback on fastly#813, move the customer contacts API
(list/create/delete) out of the root fastly package and into
fastly/customer/contacts/, matching the convention established by
fastly/apisecurity/operations.

- Rename ListContacts/CreateContact/DeleteContact to
  contacts.{List,Create,Delete} with (ctx, *fastly.Client, *Input)
  signatures and pointer-valued input fields.
- Keep JSON:API marshaling via Client.PostJSONAPI and the
  google/jsonapi unmarshaling helpers; preserve the internal payload
  struct that omits CustomerID from the body.
- Move fixtures to fastly/customer/contacts/fixtures/ (API paths and
  cassette contents unchanged).
- Update CHANGELOG entry scope to customer/contacts.
@bclerc
Copy link
Copy Markdown
Author

bclerc commented May 22, 2026

Done — I've pushed the refactor. The contacts client now lives at fastly/customer/contacts following the fastly/apisecurity/operations layout (Create/List/Delete with (ctx, *fastly.Client, *Input) signatures, pointer-valued inputs, fixtures moved under the sub-package). The endpoint is JSON:API so the code imports github.com/google/jsonapi directly for MediaType and the unmarshaling helpers — happy to adjust if you'd prefer a different approach there. CHANGELOG entry updated to feat(customer/contacts).

@kpfleming
Copy link
Copy Markdown
Member

Thanks - we're about to start a three day weekend, so we'll look into this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants