Skip to content

feat: add update_opportunity_roles + list_custom_fields (v0.3.0) - #10

Merged
jschfflr merged 1 commit into
mainfrom
feat/deal-roles-custom-fields
Jul 8, 2026
Merged

jschfflr merged 1 commit into
mainfrom
feat/deal-roles-custom-fields

Conversation

@jschfflr

@jschfflr jschfflr commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Adds two Apollo endpoints that were previously only reachable via raw curl in day-to-day use:

  • update_opportunity_roles(opportunity_id, roles)POST /opportunities/update_roles. Sets the contact roles on a deal. Replaces the full set, so callers pass the complete desired list (read current roles from get_deal(...).opportunity_contact_roles, modify, resend). Returns the updated Deal.
  • list_custom_fields()GET /typed_custom_fields. Returns account/contact/opportunity custom-field definitions as a new CustomField model (id, modality, name, type, picklist_options, mapped_crm_field).

CustomField is exported from the package root.

Why

Usage analysis of recent sessions showed opportunities/update_roles (23×) and typed_custom_fields (16×) hit directly via curl because there was no client method. This closes both gaps. Unblocks the corresponding apollo-cli commands.

Verification

ruff check ✓ · ruff format --check ✓ · pyright src/ 0 errors ✓ · pytest 179 passed (2 new) ✓

🤖 Generated with Claude Code

Two endpoints that were previously only reachable via raw curl in day-to-day
use are now first-class client methods:

- update_opportunity_roles(opportunity_id, roles) -> POST /opportunities/update_roles
  Sets the contact roles on a deal (replaces the full set; read current roles
  from get_deal(...).opportunity_contact_roles and modify). Returns the Deal.
- list_custom_fields() -> GET /typed_custom_fields
  Returns account/contact/opportunity custom-field definitions as a new
  CustomField model.

CustomField is exported from the package root. Tests added for both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
peqy[bot]
peqy Bot approved these changes Jul 8, 2026

@peqy peqy Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good — both endpoints match existing client conventions and tests cover request shape/response parsing.

Found 1 issue (0 critical, 1 improvement).

page=1,
)

async def update_opportunity_roles(self, opportunity_id: str, roles: list[dict]) -> Deal:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Improvement: roles: list[dict] is very loose (and hurts pyright/autocomplete). Since the payload shape is well-defined (contact_id, optional opportunity_contact_role_type_id, is_primary), consider introducing a small TypedDict/Pydantic model for the update payload (or at least list[dict[str, Any]]) so callers get type safety and earlier validation.

@jschfflr
jschfflr merged commit a054a7f into main Jul 8, 2026
4 checks passed
@jschfflr
jschfflr deleted the feat/deal-roles-custom-fields branch July 8, 2026 12:10
jschfflr added a commit that referenced this pull request Jul 8, 2026
…t] (v0.3.1) (#11)

Addresses the review on #10: `roles: list[dict]` was loose and gave callers
no type checking/autocomplete. Introduce a `RoleAssignment` TypedDict
(required contact_id; optional opportunity_contact_role_type_id, is_primary)
and use it in the signature. Exported from the package root. Non-breaking —
plain dicts still satisfy it structurally.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant