Skip to content

Conversation

@janpaepke
Copy link
Collaborator

Summary

Adds support for the Client Links API, enabling OAuth applications to link new or existing organizations as clients.

Changes

  • Added Client Links data model in src/data/client-links/ with ClientLinkData response type and ClientLinkLinks
  • Implemented ClientLinksBinder with create() method for POST /v2/client-links
  • Added ClientLinkHelper with getClientLink() that builds the complete redirect URL with required OAuth query parameters (client_id, state, scope, optional approval_prompt)
  • Parameter types derive from global Address using PickRequired/PickOptional for type reuse
  • Response type omits _links to enforce using the helper method instead of accessing internal properties
  • Exported types in types.ts and registered transformer in createMollieClient.ts
  • Added unit tests for create endpoint and helper method

API Details

The Client Links API provides:

  • Create client link (POST /v2/client-links) - creates a link to onboard a new organization or link an existing one

The getClientLink() helper builds the complete redirect URL that customers should be sent to, including all required OAuth query parameters.

Note

Unable to add integration tests as this endpoint requires OAuth authentication with clients.write scope.

This will be released as a beta first.

References

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive support for the Mollie Client Links API, which enables OAuth applications to onboard new organizations or link existing ones as clients. The implementation follows established patterns in the codebase and includes proper type definitions, documentation, and unit tests.

  • Introduces complete Client Links API support with create endpoint
  • Implements helper method to generate properly formatted OAuth redirect URLs
  • Uses type composition with PickRequired/PickOptional for flexible parameter definitions

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/resources/client-links.test.ts Adds comprehensive unit tests for client link creation and URL generation helper
src/types.ts Exports ClientLink type and CreateParameters for public API
src/data/client-links/data.ts Defines ClientLinkData interface and ClientLinkLinks with proper HAL+JSON structure
src/data/client-links/ClientLinkHelper.ts Implements getClientLink() helper to build complete OAuth redirect URLs with query parameters
src/data/client-links/ClientLink.ts Defines ClientLink type (omitting _links) and transform function following Seal pattern
src/createMollieClient.ts Registers client-link transformer and ClientLinksBinder with the Mollie client
src/binders/client-links/parameters.ts Defines CreateParameters using type composition from global Address type
src/binders/client-links/ClientLinksBinder.ts Implements create() method for POST /v2/client-links endpoint

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@janpaepke janpaepke added the API extension Previously missing endpoints/binders. label Nov 26, 2025
@janpaepke janpaepke added this to the 4.4.0 milestone Nov 26, 2025
@janpaepke janpaepke requested a review from edorivai November 26, 2025 17:15
@janpaepke
Copy link
Collaborator Author

According to the docs various body params are of type string | null.
We actually believe it to be optional. This is based on experience and aligns with other oAuth endpoints.
There is slight chance it might still be nullable, albeit unlikely. Unfortunately, since this is an oAuth endpoint we cannot confirm.
We deliberately plan to release it as a beta and then probably keep it like this until someone raises an issue.

Copy link
Collaborator

@edorivai edorivai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Add support for the Client Links API which allows OAuth applications to
link new or existing organizations as clients. The API provides a single
POST endpoint to create client links.

Key implementation details:
- ClientLinksBinder with create() method for POST /v2/client-links
- ClientLinkHelper with getClientLink() that builds the complete redirect
  URL with required OAuth query parameters (client_id, state, scope)
- Parameter types derive from global Address using PickRequired/PickOptional
- Response type omits _links to enforce using helper method instead

This is part of the Mollie Connect APIs (issue #459).
@janpaepke janpaepke force-pushed the feature/459-add-client-links-api branch from d358606 to c6e1552 Compare November 27, 2025 12:54
@janpaepke janpaepke merged commit 7f6c240 into master Nov 27, 2025
5 checks passed
@janpaepke janpaepke deleted the feature/459-add-client-links-api branch November 27, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API extension Previously missing endpoints/binders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Client Links API support

3 participants