Types¶
Stable types import path.
This module re-exports ID types, enums, and constants from affinity.models.types.
CompanyId
¶
Bases: IntId
Called Organization in V1.
Source code in affinity/models/types.py
44 45 | |
DropdownOptionColor
¶
Bases: IntEnum
Colors for dropdown options.
Affinity uses integer color codes for dropdown field options.
Source code in affinity/models/types.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
EnrichedFieldId
¶
Bases: StrId
Enriched field IDs are strings in V2 (e.g., 'affinity-data-description').
Source code in affinity/models/types.py
192 193 | |
EntityType
¶
Bases: OpenIntEnum
Entity types in Affinity.
Source code in affinity/models/types.py
292 293 294 295 296 297 | |
FieldId
¶
Bases: StrId
V2-style field id (e.g. 'field-123').
FieldId provides normalized comparison semantics:
- FieldId(123) == FieldId("123") → True
- FieldId("field-123") == "field-123" → True
- FieldId("field-123") == 123 → True
This normalization is specific to FieldId because field IDs uniquely come from mixed sources (some APIs return integers, some return strings like "field-123"). Other TypedId subclasses (PersonId, CompanyId, etc.) don't have this problem - they consistently use integers.
Source code in affinity/models/types.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
__eq__(other: object) -> bool
¶
Normalize comparison for FieldId.
Supports comparison with: - Other FieldId instances - Strings (e.g., "field-123" or "123") - Integers (e.g., 123)
Source code in affinity/models/types.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__hash__() -> int
¶
Hash the string representation for dict/set usage.
Source code in affinity/models/types.py
131 132 133 | |
__new__(value: Any) -> FieldId
¶
Normalize value to 'field-xxx' format at construction time.
Source code in affinity/models/types.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
__repr__() -> str
¶
Return a representation useful for debugging.
Source code in affinity/models/types.py
135 136 137 | |
__str__() -> str
¶
Return the canonical string value (e.g., 'field-123').
Source code in affinity/models/types.py
139 140 141 | |
FieldType
¶
Bases: OpenStrEnum
Field type for API parameters and response metadata.
Note: LIST is only valid in requests to list entry endpoints.
Company/person endpoints accept ENRICHED, GLOBAL, and
RELATIONSHIP_INTELLIGENCE only. HIDDEN is response-only: from API version 2026-07-15,
fields the user may not see (restricted opportunity fields) come back as
type: "hidden" with a null value; it is never a valid request value.
Source code in affinity/models/types.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
FieldValueChangeAction
¶
Bases: OpenIntEnum
Types of changes that can occur to field values.
Source code in affinity/models/types.py
608 609 610 611 612 613 | |
FieldValueType
¶
Bases: OpenStrEnum
Field value types (V2-first).
V2 represents valueType as strings (e.g. "dropdown-multi", "ranked-dropdown", "interaction").
V1 represents field value types as numeric codes; numeric inputs are normalized into the closest
V2 string type where possible.
Source code in affinity/models/types.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
InteractionDirection
¶
Bases: OpenIntEnum
Direction of communication for interactions.
Source code in affinity/models/types.py
507 508 509 510 511 | |
InteractionLoggingType
¶
Bases: OpenIntEnum
How the interaction was logged.
Source code in affinity/models/types.py
514 515 516 517 518 | |
InteractionType
¶
Bases: OpenIntEnum
Types of interactions.
Source code in affinity/models/types.py
498 499 500 501 502 503 504 | |
ListRole
¶
Bases: OpenIntEnum
Roles for list-level permissions.
Source code in affinity/models/types.py
600 601 602 603 604 605 | |
ListType
¶
Bases: OpenIntEnum
Type of entities a list can contain.
Source code in affinity/models/types.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
NoteKind
¶
Bases: OpenStrEnum
Kind of a note as reported by V2 note search (note.kind).
Source code in affinity/models/types.py
589 590 591 592 593 594 595 596 597 | |
NoteType
¶
Bases: OpenIntEnum
Types of notes.
Source code in affinity/models/types.py
580 581 582 583 584 585 586 | |
PersonType
¶
Bases: OpenStrEnum
Types of persons in Affinity.
Source code in affinity/models/types.py
300 301 302 303 304 305 | |
ReminderResetType
¶
Bases: OpenStrEnum
What resets a recurring reminder (V2 resetTrigger).
MEETING is a deprecated alias of EVENT (V2's name for a meeting or other calendar
event); "meeting" and the 1.x integers 0/1/2 are still accepted.
Source code in affinity/models/types.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
ReminderStatus
¶
Bases: OpenStrEnum
Current status of a reminder (V2 values; the 1.x integers 0/1/2 are still accepted).
Source code in affinity/models/types.py
568 569 570 571 572 573 574 575 576 577 | |
ReminderType
¶
Bases: OpenStrEnum
Types of reminders (V2 values; the 1.x integers 0 and 1 are still accepted).
Source code in affinity/models/types.py
538 539 540 541 542 543 544 545 546 | |
ResolveMode
¶
Bases: Enum
Controls how FieldResolver.get() returns complex field values.
Source code in affinity/models/types.py
491 492 493 494 495 | |
UserId
¶
Bases: PersonId
Workspace member ID. A subtype of PersonId — users are internal persons in Affinity.
Source code in affinity/models/types.py
176 177 | |
WebhookEvent
¶
Bases: OpenStrEnum
Supported webhook events (30 total).
Events cover CRUD operations on Affinity entities:
- Lists: created, updated, deleted
- List entries: created, deleted
- Notes: created, updated, deleted
- Fields: created, updated, deleted
- Field values: created, updated, deleted
- Persons: created, updated, deleted
- Organizations (companies): created, updated, deleted, merged
- Opportunities: created, updated, deleted
- Files: created, deleted
- Smart interaction values: updated
- Reminders: created, updated, deleted
This enum extends OpenStrEnum for forward compatibility - any unknown
events from Affinity are preserved as strings rather than raising errors.
See the webhooks guide for complete documentation and usage examples.
Source code in affinity/models/types.py
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
WebhookStatus
¶
Bases: OpenStrEnum
Whether a webhook delivers events (V2 status).
Source code in affinity/models/types.py
616 617 618 619 620 | |
field_id_to_v1_numeric(field_id: AnyFieldId) -> int
¶
Convert v2 FieldId into v1 numeric field_id.
Accepts: - FieldId('field-123') -> 123 Rejects: - EnrichedFieldId(...) (cannot be represented as v1 numeric id)
Source code in affinity/models/types.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |