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
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | |
EnrichedFieldId
¶
Bases: StrId
Enriched field IDs are strings in V2 (e.g., 'affinity-data-description').
Source code in affinity/models/types.py
190 191 | |
EntityType
¶
Bases: OpenIntEnum
Entity types in Affinity.
Source code in affinity/models/types.py
282 283 284 285 286 287 | |
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 | |
__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
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
__hash__() -> int
¶
Hash the string representation for dict/set usage.
Source code in affinity/models/types.py
129 130 131 | |
__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 | |
__repr__() -> str
¶
Return a representation useful for debugging.
Source code in affinity/models/types.py
133 134 135 | |
__str__() -> str
¶
Return the canonical string value (e.g., 'field-123').
Source code in affinity/models/types.py
137 138 139 | |
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.
Source code in affinity/models/types.py
429 430 431 432 433 434 435 436 437 438 439 440 441 | |
FieldValueChangeAction
¶
Bases: OpenIntEnum
Types of changes that can occur to field values.
Source code in affinity/models/types.py
533 534 535 536 537 538 | |
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
298 299 300 301 302 303 304 305 306 307 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 | |
InteractionType
¶
Bases: OpenIntEnum
Types of interactions.
Source code in affinity/models/types.py
470 471 472 473 474 475 476 | |
ListType
¶
Bases: OpenIntEnum
Type of entities a list can contain.
Source code in affinity/models/types.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
NoteType
¶
Bases: OpenIntEnum
Types of notes.
Source code in affinity/models/types.py
516 517 518 519 520 521 522 | |
PersonType
¶
Bases: OpenStrEnum
Types of persons in Affinity.
Source code in affinity/models/types.py
290 291 292 293 294 295 | |
ReminderResetType
¶
Bases: OpenIntEnum
How recurring reminders get reset.
Source code in affinity/models/types.py
500 501 502 503 504 505 | |
ReminderStatus
¶
Bases: OpenIntEnum
Current status of a reminder.
Source code in affinity/models/types.py
508 509 510 511 512 513 | |
ReminderType
¶
Bases: OpenIntEnum
Types of reminders.
Source code in affinity/models/types.py
493 494 495 496 497 | |
ResolveMode
¶
Bases: Enum
Controls how FieldResolver.get() returns complex field values.
Source code in affinity/models/types.py
463 464 465 466 467 | |
UserId
¶
Bases: PersonId
Workspace member ID. A subtype of PersonId — users are internal persons in Affinity.
Source code in affinity/models/types.py
174 175 | |
WebhookEvent
¶
Bases: OpenStrEnum
Supported webhook events (27 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
- 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
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | |
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
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |