feat(contact): add support for customer contacts#813
Conversation
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.
|
Thanks for the PR! Unfortunately we are no longer adding API endpoints to the top-level |
|
Thanks for the quick review and for pointing me to the right pattern! I'll move the new endpoints into a dedicated |
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.
|
Done — I've pushed the refactor. The contacts client now lives at |
|
Thanks - we're about to start a three day weekend, so we'll look into this next week. |
Change summary
Adds support for the customer contacts API under
/customer/{customer_id}/contacts.Three new client methods:
Client.ListContactsClient.CreateContactClient.DeleteContactThe endpoint uses JSON:API with the
customer_contactresource 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:
New Feature Submissions:
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.