Two OAuth2 and two API-key connectors:
- Google Analytics (GA4): OAuth2 with both analytics.readonly and
analytics.manage.users.readonly (readonly alone 403s on the accounts
list); v1alpha accessBindings enumerated at account and property level
and merged by email; manual account picker (Pattern 1) with a
per-connection probe and name resolver; distinct from Google Workspace.
- Dotfile: API key in the X-DOTFILE-API-KEY header (Pattern 3); GET
/v1/users (owner/admin, suspended_at) with a static probe.
- Segment (Twilio): Public API token as Bearer with a required Region
setting (US or EU) mapped to the regional host; GET /users plus per-user
GET /users/{id} for roles and /invites for pending members; per-connection
BuildProbeURL.
- Square: OAuth2 (EMPLOYEES_READ) or a personal access token (Pattern 3);
POST /v2/team-members/search returns email/status/is_owner directly, so no
role resolution; custom probe and name resolver.
Google Analytics and Square are confidential OAuth clients, wired into the
bootstrap OAuth provider list and .env.example. Segment carries a required
extra setting, so the console add-source dialog maps region onto its
segmentRegion API-key input; without that mapping the value is silently
dropped and the create is rejected.
Cassette-backed driver tests plus unit tests for the Segment probe URL and
the bootstrap OAuth provider list.
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
117 lines
3.8 KiB
YAML
117 lines
3.8 KiB
YAML
---
|
|
# Hand-authored cassette for the Segment Public API (US host; Bearer token
|
|
# stripped by the recorder). GET /users returns members without roles, so each
|
|
# member's roles are fetched via GET /users/{id} (the N+1); GET /invites adds a
|
|
# pending invite as an inactive member. Two synthetic users cover the
|
|
# Workspace Owner (admin) and a resource-scoped read-only role; the envelope
|
|
# (data.users / data.user.permissions / data.invites, data.pagination.next) and
|
|
# the UserV1 / PermissionV1 shapes mirror the live API.
|
|
version: 2
|
|
interactions:
|
|
- id: 0
|
|
request:
|
|
proto: HTTP/1.1
|
|
proto_major: 1
|
|
proto_minor: 1
|
|
content_length: 0
|
|
host: api.segmentapis.com
|
|
form:
|
|
pagination.count:
|
|
- "200"
|
|
headers:
|
|
Accept:
|
|
- application/json
|
|
url: https://api.segmentapis.com/users?pagination.count=200
|
|
method: GET
|
|
response:
|
|
proto: HTTP/2.0
|
|
proto_major: 2
|
|
proto_minor: 0
|
|
content_length: -1
|
|
uncompressed: true
|
|
body: '{"data":{"users":[{"id":"sgJDWk3K21k6LE3tLU9nRK","name":"","email":"papi@example.com"},{"id":"i2VTJURQprNfqdwjLFPWYx","name":"Sloth","email":"sloth@example.com"}],"pagination":{"current":"MA=="}}}'
|
|
headers:
|
|
Content-Type:
|
|
- application/json
|
|
status: 200 OK
|
|
code: 200
|
|
duration: 100ms
|
|
- id: 1
|
|
request:
|
|
proto: HTTP/1.1
|
|
proto_major: 1
|
|
proto_minor: 1
|
|
content_length: 0
|
|
host: api.segmentapis.com
|
|
headers:
|
|
Accept:
|
|
- application/json
|
|
url: https://api.segmentapis.com/users/sgJDWk3K21k6LE3tLU9nRK
|
|
method: GET
|
|
response:
|
|
proto: HTTP/2.0
|
|
proto_major: 2
|
|
proto_minor: 0
|
|
content_length: -1
|
|
uncompressed: true
|
|
body: '{"data":{"user":{"id":"sgJDWk3K21k6LE3tLU9nRK","name":"","email":"papi@example.com","permissions":[{"roleId":"1WDUuRLxv84rrfCNUwvkrRtkxnS","roleName":"Workspace Owner","resources":[{"id":"9aQ1Lj62S4bomZKLF4DPqW","type":"WORKSPACE","labels":[]}]}]}}}'
|
|
headers:
|
|
Content-Type:
|
|
- application/json
|
|
status: 200 OK
|
|
code: 200
|
|
duration: 100ms
|
|
- id: 2
|
|
request:
|
|
proto: HTTP/1.1
|
|
proto_major: 1
|
|
proto_minor: 1
|
|
content_length: 0
|
|
host: api.segmentapis.com
|
|
headers:
|
|
Accept:
|
|
- application/json
|
|
url: https://api.segmentapis.com/users/i2VTJURQprNfqdwjLFPWYx
|
|
method: GET
|
|
response:
|
|
proto: HTTP/2.0
|
|
proto_major: 2
|
|
proto_minor: 0
|
|
content_length: -1
|
|
uncompressed: true
|
|
body: '{"data":{"user":{"id":"i2VTJURQprNfqdwjLFPWYx","name":"Sloth","email":"sloth@example.com","permissions":[{"roleId":"2ABxYz84rrfCNUwvkrRtkxnT","roleName":"Source Read-only","resources":[{"id":"src_1a2b3c","type":"SOURCE","labels":[]}]}]}}}'
|
|
headers:
|
|
Content-Type:
|
|
- application/json
|
|
status: 200 OK
|
|
code: 200
|
|
duration: 100ms
|
|
- id: 3
|
|
request:
|
|
proto: HTTP/1.1
|
|
proto_major: 1
|
|
proto_minor: 1
|
|
content_length: 0
|
|
host: api.segmentapis.com
|
|
form:
|
|
pagination.count:
|
|
- "200"
|
|
headers:
|
|
Accept:
|
|
- application/json
|
|
url: https://api.segmentapis.com/invites?pagination.count=200
|
|
method: GET
|
|
response:
|
|
proto: HTTP/2.0
|
|
proto_major: 2
|
|
proto_minor: 0
|
|
content_length: -1
|
|
uncompressed: true
|
|
body: '{"data":{"invites":["foo@example.com"],"pagination":{"current":"MA=="}}}'
|
|
headers:
|
|
Content-Type:
|
|
- application/json
|
|
status: 200 OK
|
|
code: 200
|
|
duration: 100ms
|