From ee20b1251e677cafbf97562d84f93521d9ef58f6 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 2 Oct 2024 17:42:37 +0100 Subject: [PATCH 1/5] chore: lock file --- deno.jsonc | 4 +- deno.lock | 950 ++++------------ flake.nix | 2 +- src/v2/generated/.gitattributes | 8 - src/v2/generated/.gitignore | 1 - src/v2/generated/.openapi-generator-ignore | 23 - src/v2/generated/.openapi-generator/FILES | 107 -- src/v2/generated/.openapi-generator/VERSION | 1 - src/v2/generated/AuthApi.md | 58 - src/v2/generated/CompaniesApi.md | 333 ------ src/v2/generated/ListsApi.md | 445 -------- src/v2/generated/OpportunitiesApi.md | 130 --- src/v2/generated/PersonsApi.md | 333 ------ src/v2/generated/apis/AuthApi.ts | 97 -- src/v2/generated/apis/CompaniesApi.ts | 531 --------- src/v2/generated/apis/ListsApi.ts | 702 ------------ src/v2/generated/apis/OpportunitiesApi.ts | 211 ---- src/v2/generated/apis/PersonsApi.ts | 531 --------- src/v2/generated/apis/baseapi.ts | 37 - src/v2/generated/apis/exception.ts | 15 - src/v2/generated/auth/auth.ts | 79 -- src/v2/generated/configuration.ts | 82 -- src/v2/generated/git_push.sh | 51 - src/v2/generated/http/http.ts | 244 ---- src/v2/generated/http/isomorphic-fetch.ts | 30 - src/v2/generated/index.ts | 12 - src/v2/generated/middleware.ts | 66 -- src/v2/generated/models/Attendee.ts | 47 - .../generated/models/AuthenticationError.ts | 49 - .../generated/models/AuthenticationErrors.ts | 43 - src/v2/generated/models/AuthorizationError.ts | 49 - .../generated/models/AuthorizationErrors.ts | 43 - src/v2/generated/models/ChatMessage.ts | 96 -- src/v2/generated/models/CompaniesValue.ts | 55 - src/v2/generated/models/Company.ts | 93 -- src/v2/generated/models/CompanyData.ts | 59 - src/v2/generated/models/CompanyListEntry.ts | 82 -- src/v2/generated/models/CompanyPaged.ts | 51 - src/v2/generated/models/CompanyValue.ts | 52 - src/v2/generated/models/ConflictError.ts | 49 - src/v2/generated/models/DateValue.ts | 54 - src/v2/generated/models/Dropdown.ts | 49 - src/v2/generated/models/DropdownValue.ts | 52 - src/v2/generated/models/DropdownsValue.ts | 55 - src/v2/generated/models/Email.ts | 102 -- .../generated/models/EmptyMessageBodyError.ts | 49 - src/v2/generated/models/Errors.ts | 39 - src/v2/generated/models/Field.ts | 89 -- src/v2/generated/models/FieldMetadata.ts | 110 -- src/v2/generated/models/FieldMetadataPaged.ts | 51 - src/v2/generated/models/FieldValue.ts | 79 -- src/v2/generated/models/FloatValue.ts | 54 - src/v2/generated/models/FloatsValue.ts | 54 - src/v2/generated/models/FormulaNumber.ts | 39 - src/v2/generated/models/FormulaValue.ts | 52 - src/v2/generated/models/GenericError.ts | 49 - src/v2/generated/models/Grant.ts | 64 -- src/v2/generated/models/Interaction.ts | 42 - src/v2/generated/models/InteractionValue.ts | 52 - .../models/InvalidAcceptHeaderError.ts | 49 - .../models/InvalidMessageBodyError.ts | 49 - .../models/InvalidVersionHeaderError.ts | 49 - src/v2/generated/models/List.ts | 79 -- src/v2/generated/models/ListEntry.ts | 80 -- src/v2/generated/models/ListEntryPaged.ts | 51 - .../generated/models/ListEntryWithEntity.ts | 39 - .../models/ListEntryWithEntityPaged.ts | 51 - src/v2/generated/models/ListPaged.ts | 51 - src/v2/generated/models/ListWithType.ts | 99 -- src/v2/generated/models/ListWithTypePaged.ts | 51 - src/v2/generated/models/Location.ts | 79 -- src/v2/generated/models/LocationValue.ts | 52 - src/v2/generated/models/LocationsValue.ts | 55 - src/v2/generated/models/Meeting.ts | 105 -- .../generated/models/MethodNotAllowedError.ts | 49 - src/v2/generated/models/ModelError.ts | 72 -- src/v2/generated/models/NotFoundError.ts | 49 - src/v2/generated/models/NotFoundErrors.ts | 43 - src/v2/generated/models/ObjectSerializer.ts | 574 ---------- src/v2/generated/models/Opportunity.ts | 62 - .../generated/models/OpportunityListEntry.ts | 82 -- src/v2/generated/models/OpportunityPaged.ts | 51 - .../generated/models/OpportunityWithFields.ts | 70 -- src/v2/generated/models/Pagination.ts | 49 - src/v2/generated/models/Person.ts | 109 -- src/v2/generated/models/PersonData.ts | 86 -- src/v2/generated/models/PersonListEntry.ts | 82 -- src/v2/generated/models/PersonPaged.ts | 51 - src/v2/generated/models/PersonValue.ts | 52 - src/v2/generated/models/PersonsValue.ts | 55 - src/v2/generated/models/PhoneCall.ts | 75 -- src/v2/generated/models/RankedDropdown.ts | 69 -- .../generated/models/RankedDropdownValue.ts | 52 - src/v2/generated/models/RateLimitError.ts | 49 - src/v2/generated/models/SavedView.ts | 79 -- src/v2/generated/models/SavedViewPaged.ts | 51 - src/v2/generated/models/ServerError.ts | 49 - src/v2/generated/models/Tenant.ts | 59 - src/v2/generated/models/TextValue.ts | 55 - src/v2/generated/models/TextsValue.ts | 54 - .../models/TooManyMultipartFilesError.ts | 49 - src/v2/generated/models/User.ts | 69 -- src/v2/generated/models/ValidationError.ts | 59 - src/v2/generated/models/ValidationErrors.ts | 43 - src/v2/generated/models/WhoAmI.ts | 56 - src/v2/generated/models/all.ts | 77 -- src/v2/generated/rxjsStub.ts | 27 - src/v2/generated/servers.ts | 55 - src/v2/generated/types/ObjectParamAPI.ts | 1010 ----------------- src/v2/generated/types/ObservableAPI.ts | 903 --------------- src/v2/generated/types/PromiseAPI.ts | 647 ----------- src/v2/generated/util.ts | 37 - 112 files changed, 203 insertions(+), 12882 deletions(-) delete mode 100644 src/v2/generated/.gitattributes delete mode 100644 src/v2/generated/.gitignore delete mode 100644 src/v2/generated/.openapi-generator-ignore delete mode 100644 src/v2/generated/.openapi-generator/FILES delete mode 100644 src/v2/generated/.openapi-generator/VERSION delete mode 100644 src/v2/generated/AuthApi.md delete mode 100644 src/v2/generated/CompaniesApi.md delete mode 100644 src/v2/generated/ListsApi.md delete mode 100644 src/v2/generated/OpportunitiesApi.md delete mode 100644 src/v2/generated/PersonsApi.md delete mode 100644 src/v2/generated/apis/AuthApi.ts delete mode 100644 src/v2/generated/apis/CompaniesApi.ts delete mode 100644 src/v2/generated/apis/ListsApi.ts delete mode 100644 src/v2/generated/apis/OpportunitiesApi.ts delete mode 100644 src/v2/generated/apis/PersonsApi.ts delete mode 100644 src/v2/generated/apis/baseapi.ts delete mode 100644 src/v2/generated/apis/exception.ts delete mode 100644 src/v2/generated/auth/auth.ts delete mode 100644 src/v2/generated/configuration.ts delete mode 100644 src/v2/generated/git_push.sh delete mode 100644 src/v2/generated/http/http.ts delete mode 100644 src/v2/generated/http/isomorphic-fetch.ts delete mode 100644 src/v2/generated/index.ts delete mode 100644 src/v2/generated/middleware.ts delete mode 100644 src/v2/generated/models/Attendee.ts delete mode 100644 src/v2/generated/models/AuthenticationError.ts delete mode 100644 src/v2/generated/models/AuthenticationErrors.ts delete mode 100644 src/v2/generated/models/AuthorizationError.ts delete mode 100644 src/v2/generated/models/AuthorizationErrors.ts delete mode 100644 src/v2/generated/models/ChatMessage.ts delete mode 100644 src/v2/generated/models/CompaniesValue.ts delete mode 100644 src/v2/generated/models/Company.ts delete mode 100644 src/v2/generated/models/CompanyData.ts delete mode 100644 src/v2/generated/models/CompanyListEntry.ts delete mode 100644 src/v2/generated/models/CompanyPaged.ts delete mode 100644 src/v2/generated/models/CompanyValue.ts delete mode 100644 src/v2/generated/models/ConflictError.ts delete mode 100644 src/v2/generated/models/DateValue.ts delete mode 100644 src/v2/generated/models/Dropdown.ts delete mode 100644 src/v2/generated/models/DropdownValue.ts delete mode 100644 src/v2/generated/models/DropdownsValue.ts delete mode 100644 src/v2/generated/models/Email.ts delete mode 100644 src/v2/generated/models/EmptyMessageBodyError.ts delete mode 100644 src/v2/generated/models/Errors.ts delete mode 100644 src/v2/generated/models/Field.ts delete mode 100644 src/v2/generated/models/FieldMetadata.ts delete mode 100644 src/v2/generated/models/FieldMetadataPaged.ts delete mode 100644 src/v2/generated/models/FieldValue.ts delete mode 100644 src/v2/generated/models/FloatValue.ts delete mode 100644 src/v2/generated/models/FloatsValue.ts delete mode 100644 src/v2/generated/models/FormulaNumber.ts delete mode 100644 src/v2/generated/models/FormulaValue.ts delete mode 100644 src/v2/generated/models/GenericError.ts delete mode 100644 src/v2/generated/models/Grant.ts delete mode 100644 src/v2/generated/models/Interaction.ts delete mode 100644 src/v2/generated/models/InteractionValue.ts delete mode 100644 src/v2/generated/models/InvalidAcceptHeaderError.ts delete mode 100644 src/v2/generated/models/InvalidMessageBodyError.ts delete mode 100644 src/v2/generated/models/InvalidVersionHeaderError.ts delete mode 100644 src/v2/generated/models/List.ts delete mode 100644 src/v2/generated/models/ListEntry.ts delete mode 100644 src/v2/generated/models/ListEntryPaged.ts delete mode 100644 src/v2/generated/models/ListEntryWithEntity.ts delete mode 100644 src/v2/generated/models/ListEntryWithEntityPaged.ts delete mode 100644 src/v2/generated/models/ListPaged.ts delete mode 100644 src/v2/generated/models/ListWithType.ts delete mode 100644 src/v2/generated/models/ListWithTypePaged.ts delete mode 100644 src/v2/generated/models/Location.ts delete mode 100644 src/v2/generated/models/LocationValue.ts delete mode 100644 src/v2/generated/models/LocationsValue.ts delete mode 100644 src/v2/generated/models/Meeting.ts delete mode 100644 src/v2/generated/models/MethodNotAllowedError.ts delete mode 100644 src/v2/generated/models/ModelError.ts delete mode 100644 src/v2/generated/models/NotFoundError.ts delete mode 100644 src/v2/generated/models/NotFoundErrors.ts delete mode 100644 src/v2/generated/models/ObjectSerializer.ts delete mode 100644 src/v2/generated/models/Opportunity.ts delete mode 100644 src/v2/generated/models/OpportunityListEntry.ts delete mode 100644 src/v2/generated/models/OpportunityPaged.ts delete mode 100644 src/v2/generated/models/OpportunityWithFields.ts delete mode 100644 src/v2/generated/models/Pagination.ts delete mode 100644 src/v2/generated/models/Person.ts delete mode 100644 src/v2/generated/models/PersonData.ts delete mode 100644 src/v2/generated/models/PersonListEntry.ts delete mode 100644 src/v2/generated/models/PersonPaged.ts delete mode 100644 src/v2/generated/models/PersonValue.ts delete mode 100644 src/v2/generated/models/PersonsValue.ts delete mode 100644 src/v2/generated/models/PhoneCall.ts delete mode 100644 src/v2/generated/models/RankedDropdown.ts delete mode 100644 src/v2/generated/models/RankedDropdownValue.ts delete mode 100644 src/v2/generated/models/RateLimitError.ts delete mode 100644 src/v2/generated/models/SavedView.ts delete mode 100644 src/v2/generated/models/SavedViewPaged.ts delete mode 100644 src/v2/generated/models/ServerError.ts delete mode 100644 src/v2/generated/models/Tenant.ts delete mode 100644 src/v2/generated/models/TextValue.ts delete mode 100644 src/v2/generated/models/TextsValue.ts delete mode 100644 src/v2/generated/models/TooManyMultipartFilesError.ts delete mode 100644 src/v2/generated/models/User.ts delete mode 100644 src/v2/generated/models/ValidationError.ts delete mode 100644 src/v2/generated/models/ValidationErrors.ts delete mode 100644 src/v2/generated/models/WhoAmI.ts delete mode 100644 src/v2/generated/models/all.ts delete mode 100644 src/v2/generated/rxjsStub.ts delete mode 100644 src/v2/generated/servers.ts delete mode 100644 src/v2/generated/types/ObjectParamAPI.ts delete mode 100644 src/v2/generated/types/ObservableAPI.ts delete mode 100644 src/v2/generated/types/PromiseAPI.ts delete mode 100644 src/v2/generated/util.ts diff --git a/deno.jsonc b/deno.jsonc index 8dece39..ab56ccc 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@deno/dnt": "jsr:@deno/dnt@^0.41.3", "@std/assert": "jsr:@std/assert@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.0", "@std/jsonc": "jsr:@std/jsonc@^1.0.0", @@ -24,7 +24,7 @@ "snapshot-update": "deno task test --allow-write=./src/v1/tests/__snapshots__,./src/v2/tests/__snapshots__ -- --update", "format": "deno fmt && nixpkgs-fmt *.nix && yamllint . && yamlfmt .", "lint": "deno lint", - "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.6", + "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.7", "generate-v2-client": "rm -rf src/v2/generated && openapi-generator-cli generate", "update-deno-lock": "deno cache --lock-write src/index.ts", "update-flake-lock": "nix --option commit-lockfile-summary 'chore: update flake.lock' flake update --commit-lock-file", diff --git a/deno.lock b/deno.lock index dec0f0e..038b856 100644 --- a/deno.lock +++ b/deno.lock @@ -4,50 +4,40 @@ "specifiers": { "jsr:@david/code-block-writer@^13.0.2": "jsr:@david/code-block-writer@13.0.2", "jsr:@deno/cache-dir@^0.10.3": "jsr:@deno/cache-dir@0.10.3", - "jsr:@deno/dnt@^0.41.2": "jsr:@deno/dnt@0.41.3", - "jsr:@deno/graph@^0.73.1": "jsr:@deno/graph@0.73.1", + "jsr:@deno/dnt@^0.41.3": "jsr:@deno/dnt@0.41.3", "jsr:@std/assert@^0.223.0": "jsr:@std/assert@0.223.0", "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", - "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.2", - "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.2", - "jsr:@std/async@^1.0.2": "jsr:@std/async@1.0.3", + "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.6", + "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.6", "jsr:@std/bytes@^0.223.0": "jsr:@std/bytes@0.223.0", - "jsr:@std/bytes@^1.0.2-rc.3": "jsr:@std/bytes@1.0.2", - "jsr:@std/data-structures@^1.0.1": "jsr:@std/data-structures@1.0.1", - "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.0", + "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.2", "jsr:@std/fmt@^0.223": "jsr:@std/fmt@0.223.0", - "jsr:@std/fmt@^0.223.0": "jsr:@std/fmt@0.223.0", - "jsr:@std/fmt@^0.225.3": "jsr:@std/fmt@0.225.3", - "jsr:@std/fs@1": "jsr:@std/fs@1.0.1", + "jsr:@std/fs@1": "jsr:@std/fs@1.0.4", "jsr:@std/fs@^0.223": "jsr:@std/fs@0.223.0", "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", - "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.1", - "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.1", - "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.1", - "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.1", + "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.4", + "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.4", + "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.4", + "jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4", "jsr:@std/io": "jsr:@std/io@0.223.0", "jsr:@std/io@^0.223": "jsr:@std/io@0.223.0", - "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.0", - "jsr:@std/path@1": "jsr:@std/path@1.0.2", + "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.1", + "jsr:@std/path@1": "jsr:@std/path@1.0.6", "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", "jsr:@std/path@^0.223": "jsr:@std/path@0.223.0", - "jsr:@std/path@^0.223.0": "jsr:@std/path@0.223.0", "jsr:@std/path@^0.225.2": "jsr:@std/path@0.225.2", - "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.2", - "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.2", - "jsr:@std/streams@^1.0.0": "jsr:@std/streams@1.0.1", + "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.6": "jsr:@std/path@1.0.6", "jsr:@std/testing@^1.0.0": "jsr:@std/testing@1.0.0", "jsr:@ts-morph/bootstrap@^0.24.0": "jsr:@ts-morph/bootstrap@0.24.0", "jsr:@ts-morph/common@^0.24.0": "jsr:@ts-morph/common@0.24.0", - "npm:@openapitools/openapi-generator-cli@2.13.4": "npm:@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", - "npm:@openapitools/openapi-generator-cli@2.13.5": "npm:@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", "npm:@types/node": "npm:@types/node@18.16.19", - "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.4", - "npm:axios@^1.7.3": "npm:axios@1.7.4", + "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.7", + "npm:axios@^1.7.3": "npm:axios@1.7.7", "npm:fetch-blob@^4.0.0": "npm:fetch-blob@4.0.0", "npm:fetch-mock@^11.1.3": "npm:fetch-mock@11.1.3", - "npm:typedoc@0.25.13": "npm:typedoc@0.25.13_typescript@5.4.5", - "npm:typedoc@0.26.6": "npm:typedoc@0.26.6_typescript@5.5.4", + "npm:typedoc@0.26.7": "npm:typedoc@0.26.7_typescript@5.5.4", "npm:typescript@^5.4.5": "npm:typescript@5.5.4" }, "jsr": { @@ -57,7 +47,6 @@ "@deno/cache-dir@0.10.3": { "integrity": "eb022f84ecc49c91d9d98131c6e6b118ff63a29e343624d058646b9d50404776", "dependencies": [ - "jsr:@deno/graph@^0.73.1", "jsr:@std/fmt@^0.223", "jsr:@std/fs@^0.223", "jsr:@std/io@^0.223", @@ -75,20 +64,11 @@ "jsr:@ts-morph/bootstrap@^0.24.0" ] }, - "@deno/graph@0.73.1": { - "integrity": "cd69639d2709d479037d5ce191a422eabe8d71bb68b0098344f6b07411c84d41" - }, "@std/assert@0.223.0": { - "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24", - "dependencies": [ - "jsr:@std/fmt@^0.223.0" - ] + "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24" }, "@std/assert@0.226.0": { - "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3", - "dependencies": [ - "jsr:@std/internal@^1.0.0" - ] + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3" }, "@std/assert@1.0.2": { "integrity": "ccacec332958126deaceb5c63ff8b4eaf9f5ed0eac9feccf124110435e59e49c", @@ -96,33 +76,23 @@ "jsr:@std/internal@^1.0.1" ] }, - "@std/async@1.0.3": { - "integrity": "6ed64678db43451683c6c176a21426a2ccd21ba0269ebb2c36133ede3f165792" + "@std/assert@1.0.6": { + "integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207", + "dependencies": [ + "jsr:@std/internal@^1.0.4" + ] }, "@std/bytes@0.223.0": { "integrity": "84b75052cd8680942c397c2631318772b295019098f40aac5c36cead4cba51a8" }, - "@std/bytes@1.0.2": { - "integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57" - }, - "@std/data-structures@1.0.1": { - "integrity": "e4fa6bcc33839979ac118e2746f349cd7b57c58bd3036b5b82ac608771ee856e" - }, "@std/fmt@0.223.0": { "integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208" }, - "@std/fmt@0.225.3": { - "integrity": "cb6ea567155f9865b80b502b2dde7671803eddd6dad743d8851d0de2c40bd349" - }, - "@std/fmt@1.0.0": { - "integrity": "8a95c9fdbb61559418ccbc0f536080cf43341655e1444f9d375a66886ceaaa3d" + "@std/fmt@1.0.2": { + "integrity": "87e9dfcdd3ca7c066e0c3c657c1f987c82888eb8103a3a3baa62684ffeb0f7a7" }, "@std/fs@0.223.0": { - "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c", - "dependencies": [ - "jsr:@std/assert@^0.223.0", - "jsr:@std/path@^0.223.0" - ] + "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c" }, "@std/fs@0.229.3": { "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", @@ -130,18 +100,18 @@ "jsr:@std/path@1.0.0-rc.1" ] }, - "@std/fs@1.0.1": { - "integrity": "d6914ca2c21abe591f733b31dbe6331e446815e513e2451b3b9e472daddfefcb", + "@std/fs@1.0.4": { + "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", "dependencies": [ - "jsr:@std/path@^1.0.2" + "jsr:@std/path@^1.0.6" ] }, - "@std/internal@1.0.0": { - "integrity": "ac6a6dfebf838582c4b4f61a6907374e27e05bedb6ce276e0f1608fe84e7cd9a" - }, "@std/internal@1.0.1": { "integrity": "6f8c7544d06a11dd256c8d6ba54b11ed870aac6c5aeafff499892662c57673e6" }, + "@std/internal@1.0.4": { + "integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422" + }, "@std/io@0.223.0": { "integrity": "2d8c3c2ab3a515619b90da2c6ff5ea7b75a94383259ef4d02116b228393f84f1", "dependencies": [ @@ -149,8 +119,8 @@ "jsr:@std/bytes@^0.223.0" ] }, - "@std/jsonc@1.0.0": { - "integrity": "835da212e586f3ef94ab25e8f0e8a7711a86fddbee95ad40c34d6b3d74da1a1b" + "@std/jsonc@1.0.1": { + "integrity": "6b36956e2a7cbb08ca5ad7fbec72e661e6217c202f348496ea88747636710dda" }, "@std/path@0.223.0": { "integrity": "593963402d7e6597f5a6e620931661053572c982fc014000459edc1f93cc3989", @@ -167,31 +137,13 @@ "@std/path@1.0.0-rc.1": { "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" }, - "@std/path@1.0.2": { - "integrity": "a452174603f8c620bd278a380c596437a9eef50c891c64b85812f735245d9ec7" - }, - "@std/streams@1.0.1": { - "integrity": "b07008b83fd7ae08965920d0fd700e07caf233bdd81e0ef1c8cca6c4140da364", - "dependencies": [ - "jsr:@std/bytes@^1.0.2-rc.3" - ] - }, - "@std/testing@0.225.0": { - "integrity": "53ca3c47eb121acabda633fd50699c4b33da6a7ce3e5bb34d7277d15df5f0a6e", - "dependencies": [ - "jsr:@std/assert@^0.226.0", - "jsr:@std/fmt@^0.225.3", - "jsr:@std/fs@^0.229.1", - "jsr:@std/internal@^1.0.0", - "jsr:@std/path@^0.225.2" - ] + "@std/path@1.0.6": { + "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" }, "@std/testing@1.0.0": { "integrity": "27cfc06392c69c2acffe54e6d0bcb5f961cf193f519255372bd4fff1481bfef8", "dependencies": [ "jsr:@std/assert@^1.0.2", - "jsr:@std/async@^1.0.2", - "jsr:@std/data-structures@^1.0.1", "jsr:@std/fs@^1.0.1", "jsr:@std/internal@^1.0.1", "jsr:@std/path@^1.0.2" @@ -212,119 +164,41 @@ } }, "npm": { - "@babel/runtime@7.24.6": { - "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", - "dependencies": { - "regenerator-runtime": "regenerator-runtime@0.14.1" - } - }, - "@lukeed/csprng@1.1.0": { - "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", - "dependencies": {} - }, - "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", - "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "axios": "axios@1.6.8", - "rxjs": "rxjs@7.8.1" - } - }, - "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", - "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "axios": "axios@1.7.4", - "rxjs": "rxjs@7.8.1" - } - }, - "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1": { - "integrity": "sha512-DGv34UHsZBxCM3H5QGE2XE/+oLJzz5+714JQjBhjD9VccFlQs3LRxo/epso4l7nJIiNlZkPyIUC8WzfU/5RTsQ==", - "dependencies": { - "iterare": "iterare@1.2.1", - "reflect-metadata": "reflect-metadata@0.1.13", - "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2", - "uid": "uid@2.0.2" - } - }, - "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1": { - "integrity": "sha512-N06P5ncknW/Pm8bj964WvLIZn2gNhHliCBoAO1LeBvNImYkecqKcrmLbY49Fa1rmMfEM3MuBHeDys3edeuYAOA==", - "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", - "fast-safe-stringify": "fast-safe-stringify@2.1.1", - "iterare": "iterare@1.2.1", - "path-to-regexp": "path-to-regexp@3.2.0", - "reflect-metadata": "reflect-metadata@0.1.13", - "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2", - "uid": "uid@2.0.2" - } - }, - "@nuxtjs/opencollective@0.3.2": { - "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", + "@shikijs/core@1.21.0": { + "integrity": "sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==", "dependencies": { - "chalk": "chalk@4.1.2", - "consola": "consola@2.15.3", - "node-fetch": "node-fetch@2.7.0" + "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", + "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "@types/hast": "@types/hast@3.0.4", + "hast-util-to-html": "hast-util-to-html@9.0.3" } }, - "@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-4JKyrk55ohQK2FcuZbPdNvxdyXD14jjOIvE8hYjJ+E1cHbRbfXQXbYnjTODFE52Gx8eAxz8C9icuhDYDLn7nww==", + "@shikijs/engine-javascript@1.21.0": { + "integrity": "sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==", "dependencies": { - "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", - "axios": "axios@1.6.8", - "chalk": "chalk@4.1.2", - "commander": "commander@8.3.0", - "compare-versions": "compare-versions@4.1.4", - "concurrently": "concurrently@6.5.1", - "console.table": "console.table@0.10.0", - "fs-extra": "fs-extra@10.1.0", - "glob": "glob@7.2.3", - "https-proxy-agent": "https-proxy-agent@7.0.4", - "inquirer": "inquirer@8.2.6", - "lodash": "lodash@4.17.21", - "reflect-metadata": "reflect-metadata@0.1.13", - "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2" + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "oniguruma-to-js": "oniguruma-to-js@0.4.3" } }, - "@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-9VgeKOTiiatKSwZDKKB3C86cW8tN9eDcFohotD4eisdK38UQswk/4Ysoq9KChRCbymjoMp6AIDHPtK1DQ2fTgw==", + "@shikijs/engine-oniguruma@1.21.0": { + "integrity": "sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==", "dependencies": { - "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", - "axios": "axios@1.7.4", - "chalk": "chalk@4.1.2", - "commander": "commander@8.3.0", - "compare-versions": "compare-versions@4.1.4", - "concurrently": "concurrently@6.5.1", - "console.table": "console.table@0.10.0", - "fs-extra": "fs-extra@10.1.0", - "glob": "glob@7.2.3", - "https-proxy-agent": "https-proxy-agent@7.0.4", - "inquirer": "inquirer@8.2.6", - "lodash": "lodash@4.17.21", - "reflect-metadata": "reflect-metadata@0.1.13", - "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2" + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2" } }, - "@shikijs/core@1.16.1": { - "integrity": "sha512-aI0hBtw+a6KsJp2jcD4YuQqKpeCbURMZbhHVozDknJpm+KJqeMRkEnfBC8BaKE/5XC+uofPgCLsa/TkTk0Ba0w==", + "@shikijs/types@1.21.0": { + "integrity": "sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==", "dependencies": { - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", "@types/hast": "@types/hast@3.0.4" } }, - "@shikijs/vscode-textmate@9.2.0": { - "integrity": "sha512-5FinaOp6Vdh/dl4/yaOTh0ZeKch+rYS8DUb38V3GMKYVkdqzxw53lViRKUYkVILRiVQT7dcPC7VvAKOR73zVtQ==", + "@shikijs/vscode-textmate@9.2.2": { + "integrity": "sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==", "dependencies": {} }, "@types/glob-to-regexp@0.4.4": { @@ -337,6 +211,12 @@ "@types/unist": "@types/unist@3.0.3" } }, + "@types/mdast@4.0.4": { + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3" + } + }, "@types/node@18.16.19": { "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "dependencies": {} @@ -345,32 +225,10 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "dependencies": {} }, - "agent-base@7.1.1": { - "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", - "dependencies": { - "debug": "debug@4.3.5" - } - }, - "ansi-escapes@4.3.2": { - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dependencies": { - "type-fest": "type-fest@0.21.3" - } - }, - "ansi-regex@5.0.1": { - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dependencies": {} - }, - "ansi-sequence-parser@1.1.1": { - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "@ungap/structured-clone@1.2.0": { + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dependencies": {} }, - "ansi-styles@4.3.0": { - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "color-convert@2.0.1" - } - }, "argparse@2.0.1": { "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dependencies": {} @@ -379,26 +237,18 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dependencies": {} }, - "axios-mock-adapter@2.0.0_axios@1.7.4": { + "axios-mock-adapter@2.0.0_axios@1.7.7": { "integrity": "sha512-D/K0J5Zm6KvaMTnsWrBQZWLzKN9GxUFZEa0mx2qeEHXDeTugCoplWehy8y36dj5vuSjhe1u/Dol8cZ8lzzmDew==", "dependencies": { - "axios": "axios@1.7.4", + "axios": "axios@1.7.7", "fast-deep-equal": "fast-deep-equal@3.1.3", "is-buffer": "is-buffer@2.0.5" } }, - "axios@1.6.8": { - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "axios@1.7.7": { + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "dependencies": { - "follow-redirects": "follow-redirects@1.15.6", - "form-data": "form-data@4.0.0", - "proxy-from-env": "proxy-from-env@1.1.0" - } - }, - "axios@1.7.4": { - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", - "dependencies": { - "follow-redirects": "follow-redirects@1.15.6", + "follow-redirects": "follow-redirects@1.15.8", "form-data": "form-data@4.0.0", "proxy-from-env": "proxy-from-env@1.1.0" } @@ -407,83 +257,22 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dependencies": {} }, - "base64-js@1.5.1": { - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dependencies": {} - }, - "bl@4.1.0": { - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dependencies": { - "buffer": "buffer@5.7.1", - "inherits": "inherits@2.0.4", - "readable-stream": "readable-stream@3.6.2" - } - }, - "brace-expansion@1.1.11": { - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "balanced-match@1.0.2", - "concat-map": "concat-map@0.0.1" - } - }, "brace-expansion@2.0.1": { "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dependencies": { "balanced-match": "balanced-match@1.0.2" } }, - "buffer@5.7.1": { - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dependencies": { - "base64-js": "base64-js@1.5.1", - "ieee754": "ieee754@1.2.1" - } - }, - "chalk@4.1.2": { - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "ansi-styles@4.3.0", - "supports-color": "supports-color@7.2.0" - } - }, - "chardet@0.7.0": { - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dependencies": {} - }, - "cli-cursor@3.1.0": { - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dependencies": { - "restore-cursor": "restore-cursor@3.1.0" - } - }, - "cli-spinners@2.9.2": { - "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "ccount@2.0.1": { + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", "dependencies": {} }, - "cli-width@3.0.0": { - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "character-entities-html4@2.1.0": { + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", "dependencies": {} }, - "cliui@7.0.4": { - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dependencies": { - "string-width": "string-width@4.2.3", - "strip-ansi": "strip-ansi@6.0.1", - "wrap-ansi": "wrap-ansi@7.0.0" - } - }, - "clone@1.0.4": { - "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", - "dependencies": {} - }, - "color-convert@2.0.1": { - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "color-name@1.1.4" - } - }, - "color-name@1.1.4": { - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "character-entities-legacy@3.0.0": { + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", "dependencies": {} }, "combined-stream@1.0.8": { @@ -492,59 +281,10 @@ "delayed-stream": "delayed-stream@1.0.0" } }, - "commander@8.3.0": { - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "comma-separated-tokens@2.0.3": { + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", "dependencies": {} }, - "compare-versions@4.1.4": { - "integrity": "sha512-FemMreK9xNyL8gQevsdRMrvO4lFCkQP7qbuktn1q8ndcNk1+0mz7lgE7b/sNvbhVgY4w6tMN1FDp6aADjqw2rw==", - "dependencies": {} - }, - "concat-map@0.0.1": { - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dependencies": {} - }, - "concurrently@6.5.1": { - "integrity": "sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==", - "dependencies": { - "chalk": "chalk@4.1.2", - "date-fns": "date-fns@2.30.0", - "lodash": "lodash@4.17.21", - "rxjs": "rxjs@6.6.7", - "spawn-command": "spawn-command@0.0.2-1", - "supports-color": "supports-color@8.1.1", - "tree-kill": "tree-kill@1.2.2", - "yargs": "yargs@16.2.0" - } - }, - "consola@2.15.3": { - "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==", - "dependencies": {} - }, - "console.table@0.10.0": { - "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", - "dependencies": { - "easy-table": "easy-table@1.1.0" - } - }, - "date-fns@2.30.0": { - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dependencies": { - "@babel/runtime": "@babel/runtime@7.24.6" - } - }, - "debug@4.3.5": { - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", - "dependencies": { - "ms": "ms@2.1.2" - } - }, - "defaults@1.0.4": { - "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", - "dependencies": { - "clone": "clone@1.0.4" - } - }, "delayed-stream@1.0.0": { "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dependencies": {} @@ -553,44 +293,20 @@ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dependencies": {} }, - "easy-table@1.1.0": { - "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", + "devlop@1.1.0": { + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", "dependencies": { - "wcwidth": "wcwidth@1.0.1" + "dequal": "dequal@2.0.3" } }, - "emoji-regex@8.0.0": { - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dependencies": {} - }, "entities@4.5.0": { "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dependencies": {} }, - "escalade@3.1.2": { - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", - "dependencies": {} - }, - "escape-string-regexp@1.0.5": { - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dependencies": {} - }, - "external-editor@3.1.0": { - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dependencies": { - "chardet": "chardet@0.7.0", - "iconv-lite": "iconv-lite@0.4.24", - "tmp": "tmp@0.0.33" - } - }, "fast-deep-equal@3.1.3": { "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dependencies": {} }, - "fast-safe-stringify@2.1.1": { - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "dependencies": {} - }, "fetch-blob@4.0.0": { "integrity": "sha512-nPmnhRmpNMjYWnp9EBMGs6z5lq9RXed5W1vuZcECrsDVQInM8AMQSooVb3X183Aole60adzjWbH9qlRFWzDDTA==", "dependencies": { @@ -607,14 +323,8 @@ "regexparam": "regexparam@3.0.0" } }, - "figures@3.2.0": { - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dependencies": { - "escape-string-regexp": "escape-string-regexp@1.0.5" - } - }, - "follow-redirects@1.15.6": { - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "follow-redirects@1.15.8": { + "integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==", "dependencies": {} }, "form-data@4.0.0": { @@ -625,145 +335,50 @@ "mime-types": "mime-types@2.1.35" } }, - "fs-extra@10.1.0": { - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "graceful-fs@4.2.11", - "jsonfile": "jsonfile@6.1.0", - "universalify": "universalify@2.0.1" - } - }, - "fs.realpath@1.0.0": { - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dependencies": {} - }, - "get-caller-file@2.0.5": { - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dependencies": {} - }, "glob-to-regexp@0.4.1": { "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dependencies": {} }, - "glob@7.2.3": { - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "hast-util-to-html@9.0.3": { + "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", "dependencies": { - "fs.realpath": "fs.realpath@1.0.0", - "inflight": "inflight@1.0.6", - "inherits": "inherits@2.0.4", - "minimatch": "minimatch@3.1.2", - "once": "once@1.4.0", - "path-is-absolute": "path-is-absolute@1.0.1" + "@types/hast": "@types/hast@3.0.4", + "@types/unist": "@types/unist@3.0.3", + "ccount": "ccount@2.0.1", + "comma-separated-tokens": "comma-separated-tokens@2.0.3", + "hast-util-whitespace": "hast-util-whitespace@3.0.0", + "html-void-elements": "html-void-elements@3.0.0", + "mdast-util-to-hast": "mdast-util-to-hast@13.2.0", + "property-information": "property-information@6.5.0", + "space-separated-tokens": "space-separated-tokens@2.0.2", + "stringify-entities": "stringify-entities@4.0.4", + "zwitch": "zwitch@2.0.4" } }, - "graceful-fs@4.2.11": { - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dependencies": {} - }, - "has-flag@4.0.0": { - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dependencies": {} - }, - "https-proxy-agent@7.0.4": { - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", - "dependencies": { - "agent-base": "agent-base@7.1.1", - "debug": "debug@4.3.5" - } - }, - "iconv-lite@0.4.24": { - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "hast-util-whitespace@3.0.0": { + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", "dependencies": { - "safer-buffer": "safer-buffer@2.1.2" - } - }, - "ieee754@1.2.1": { - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dependencies": {} - }, - "inflight@1.0.6": { - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dependencies": { - "once": "once@1.4.0", - "wrappy": "wrappy@1.0.2" + "@types/hast": "@types/hast@3.0.4" } }, - "inherits@2.0.4": { - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "html-void-elements@3.0.0": { + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", "dependencies": {} }, - "inquirer@8.2.6": { - "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==", - "dependencies": { - "ansi-escapes": "ansi-escapes@4.3.2", - "chalk": "chalk@4.1.2", - "cli-cursor": "cli-cursor@3.1.0", - "cli-width": "cli-width@3.0.0", - "external-editor": "external-editor@3.1.0", - "figures": "figures@3.2.0", - "lodash": "lodash@4.17.21", - "mute-stream": "mute-stream@0.0.8", - "ora": "ora@5.4.1", - "run-async": "run-async@2.4.1", - "rxjs": "rxjs@7.8.1", - "string-width": "string-width@4.2.3", - "strip-ansi": "strip-ansi@6.0.1", - "through": "through@2.3.8", - "wrap-ansi": "wrap-ansi@6.2.0" - } - }, "is-buffer@2.0.5": { "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "dependencies": {} }, - "is-fullwidth-code-point@3.0.0": { - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dependencies": {} - }, - "is-interactive@1.0.0": { - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "dependencies": {} - }, "is-subset@0.1.1": { "integrity": "sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw==", "dependencies": {} }, - "is-unicode-supported@0.1.0": { - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dependencies": {} - }, - "iterare@1.2.1": { - "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", - "dependencies": {} - }, - "jsonc-parser@3.2.1": { - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dependencies": {} - }, - "jsonfile@6.1.0": { - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dependencies": { - "graceful-fs": "graceful-fs@4.2.11", - "universalify": "universalify@2.0.1" - } - }, "linkify-it@5.0.0": { "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dependencies": { "uc.micro": "uc.micro@2.1.0" } }, - "lodash@4.17.21": { - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dependencies": {} - }, - "log-symbols@4.1.0": { - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dependencies": { - "chalk": "chalk@4.1.2", - "is-unicode-supported": "is-unicode-supported@0.1.0" - } - }, "lunr@2.3.9": { "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dependencies": {} @@ -779,94 +394,79 @@ "uc.micro": "uc.micro@2.1.0" } }, - "marked@4.3.0": { - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "dependencies": {} + "mdast-util-to-hast@13.2.0": { + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dependencies": { + "@types/hast": "@types/hast@3.0.4", + "@types/mdast": "@types/mdast@4.0.4", + "@ungap/structured-clone": "@ungap/structured-clone@1.2.0", + "devlop": "devlop@1.1.0", + "micromark-util-sanitize-uri": "micromark-util-sanitize-uri@2.0.0", + "trim-lines": "trim-lines@3.0.1", + "unist-util-position": "unist-util-position@5.0.0", + "unist-util-visit": "unist-util-visit@5.0.0", + "vfile": "vfile@6.0.3" + } }, "mdurl@2.0.0": { "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dependencies": {} }, - "mime-db@1.52.0": { - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dependencies": {} - }, - "mime-types@2.1.35": { - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "micromark-util-character@2.1.0": { + "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", "dependencies": { - "mime-db": "mime-db@1.52.0" + "micromark-util-symbol": "micromark-util-symbol@2.0.0", + "micromark-util-types": "micromark-util-types@2.0.0" } }, - "mimic-fn@2.1.0": { - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "micromark-util-encode@2.0.0": { + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", "dependencies": {} }, - "minimatch@3.1.2": { - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "brace-expansion@1.1.11" - } - }, - "minimatch@9.0.5": { - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "micromark-util-sanitize-uri@2.0.0": { + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", "dependencies": { - "brace-expansion": "brace-expansion@2.0.1" + "micromark-util-character": "micromark-util-character@2.1.0", + "micromark-util-encode": "micromark-util-encode@2.0.0", + "micromark-util-symbol": "micromark-util-symbol@2.0.0" } }, - "ms@2.1.2": { - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "micromark-util-symbol@2.0.0": { + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", "dependencies": {} }, - "mute-stream@0.0.8": { - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "micromark-util-types@2.0.0": { + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", "dependencies": {} }, - "node-domexception@1.0.0": { - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dependencies": {} }, - "node-fetch@2.7.0": { - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "whatwg-url": "whatwg-url@5.0.0" + "mime-db": "mime-db@1.52.0" } }, - "once@1.4.0": { - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "minimatch@9.0.5": { + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dependencies": { - "wrappy": "wrappy@1.0.2" + "brace-expansion": "brace-expansion@2.0.1" } }, - "onetime@5.1.2": { - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dependencies": { - "mimic-fn": "mimic-fn@2.1.0" - } + "node-domexception@1.0.0": { + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "dependencies": {} }, - "ora@5.4.1": { - "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "oniguruma-to-js@0.4.3": { + "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", "dependencies": { - "bl": "bl@4.1.0", - "chalk": "chalk@4.1.2", - "cli-cursor": "cli-cursor@3.1.0", - "cli-spinners": "cli-spinners@2.9.2", - "is-interactive": "is-interactive@1.0.0", - "is-unicode-supported": "is-unicode-supported@0.1.0", - "log-symbols": "log-symbols@4.1.0", - "strip-ansi": "strip-ansi@6.0.1", - "wcwidth": "wcwidth@1.0.1" + "regex": "regex@4.3.3" } }, - "os-tmpdir@1.0.2": { - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dependencies": {} - }, - "path-is-absolute@1.0.1": { - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dependencies": {} - }, - "path-to-regexp@3.2.0": { - "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==", + "property-information@6.5.0": { + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", "dependencies": {} }, "proxy-from-env@1.1.0": { @@ -877,173 +477,51 @@ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", "dependencies": {} }, - "readable-stream@3.6.2": { - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "inherits@2.0.4", - "string_decoder": "string_decoder@1.3.0", - "util-deprecate": "util-deprecate@1.0.2" - } - }, - "reflect-metadata@0.1.13": { - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", - "dependencies": {} - }, - "regenerator-runtime@0.14.1": { - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "regex@4.3.3": { + "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", "dependencies": {} }, "regexparam@3.0.0": { "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", "dependencies": {} }, - "require-directory@2.1.1": { - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dependencies": {} - }, - "restore-cursor@3.1.0": { - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dependencies": { - "onetime": "onetime@5.1.2", - "signal-exit": "signal-exit@3.0.7" - } - }, - "run-async@2.4.1": { - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dependencies": {} - }, - "rxjs@6.6.7": { - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "shiki@1.21.0": { + "integrity": "sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==", "dependencies": { - "tslib": "tslib@1.14.1" - } - }, - "rxjs@7.8.1": { - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dependencies": { - "tslib": "tslib@2.6.2" - } - }, - "safe-buffer@5.2.1": { - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dependencies": {} - }, - "safer-buffer@2.1.2": { - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dependencies": {} - }, - "shiki@0.14.7": { - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", - "dependencies": { - "ansi-sequence-parser": "ansi-sequence-parser@1.1.1", - "jsonc-parser": "jsonc-parser@3.2.1", - "vscode-oniguruma": "vscode-oniguruma@1.7.0", - "vscode-textmate": "vscode-textmate@8.0.0" - } - }, - "shiki@1.16.1": { - "integrity": "sha512-tCJIMaxDVB1mEIJ5TvfZU7kCPB5eo9fli5+21Olc/bmyv+w8kye3JOp+LZRmGkAyT71hrkefQhTiY+o9mBikRQ==", - "dependencies": { - "@shikijs/core": "@shikijs/core@1.16.1", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", + "@shikijs/core": "@shikijs/core@1.21.0", + "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", + "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", "@types/hast": "@types/hast@3.0.4" } }, - "signal-exit@3.0.7": { - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "space-separated-tokens@2.0.2": { + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", "dependencies": {} }, - "spawn-command@0.0.2-1": { - "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", - "dependencies": {} - }, - "string-width@4.2.3": { - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "emoji-regex@8.0.0", - "is-fullwidth-code-point": "is-fullwidth-code-point@3.0.0", - "strip-ansi": "strip-ansi@6.0.1" - } - }, - "string_decoder@1.3.0": { - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "stringify-entities@4.0.4": { + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", "dependencies": { - "safe-buffer": "safe-buffer@5.2.1" + "character-entities-html4": "character-entities-html4@2.1.0", + "character-entities-legacy": "character-entities-legacy@3.0.0" } }, - "strip-ansi@6.0.1": { - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "ansi-regex@5.0.1" - } - }, - "supports-color@7.2.0": { - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "has-flag@4.0.0" - } - }, - "supports-color@8.1.1": { - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dependencies": { - "has-flag": "has-flag@4.0.0" - } - }, - "through@2.3.8": { - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "trim-lines@3.0.1": { + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", "dependencies": {} }, - "tmp@0.0.33": { - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dependencies": { - "os-tmpdir": "os-tmpdir@1.0.2" - } - }, - "tr46@0.0.3": { - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dependencies": {} - }, - "tree-kill@1.2.2": { - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dependencies": {} - }, - "tslib@1.14.1": { - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dependencies": {} - }, - "tslib@2.6.2": { - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dependencies": {} - }, - "type-fest@0.21.3": { - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dependencies": {} - }, - "typedoc@0.25.13_typescript@5.4.5": { - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", - "dependencies": { - "lunr": "lunr@2.3.9", - "marked": "marked@4.3.0", - "minimatch": "minimatch@9.0.5", - "shiki": "shiki@0.14.7", - "typescript": "typescript@5.4.5" - } - }, - "typedoc@0.26.6_typescript@5.5.4": { - "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", + "typedoc@0.26.7_typescript@5.5.4": { + "integrity": "sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==", "dependencies": { "lunr": "lunr@2.3.9", "markdown-it": "markdown-it@14.1.0", "minimatch": "minimatch@9.0.5", - "shiki": "shiki@1.16.1", + "shiki": "shiki@1.21.0", "typescript": "typescript@5.5.4", "yaml": "yaml@2.5.1" } }, - "typescript@5.4.5": { - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dependencies": {} - }, "typescript@5.5.4": { "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dependencies": {} @@ -1052,88 +530,60 @@ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dependencies": {} }, - "uid@2.0.2": { - "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", + "unist-util-is@6.0.0": { + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", "dependencies": { - "@lukeed/csprng": "@lukeed/csprng@1.1.0" + "@types/unist": "@types/unist@3.0.3" } }, - "universalify@2.0.1": { - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dependencies": {} - }, - "util-deprecate@1.0.2": { - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dependencies": {} - }, - "vscode-oniguruma@1.7.0": { - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dependencies": {} - }, - "vscode-textmate@8.0.0": { - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dependencies": {} - }, - "wcwidth@1.0.1": { - "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "unist-util-position@5.0.0": { + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", "dependencies": { - "defaults": "defaults@1.0.4" + "@types/unist": "@types/unist@3.0.3" } }, - "webidl-conversions@3.0.1": { - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dependencies": {} - }, - "whatwg-url@5.0.0": { - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "unist-util-stringify-position@4.0.0": { + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", "dependencies": { - "tr46": "tr46@0.0.3", - "webidl-conversions": "webidl-conversions@3.0.1" + "@types/unist": "@types/unist@3.0.3" } }, - "wrap-ansi@6.2.0": { - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "unist-util-visit-parents@6.0.1": { + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", "dependencies": { - "ansi-styles": "ansi-styles@4.3.0", - "string-width": "string-width@4.2.3", - "strip-ansi": "strip-ansi@6.0.1" + "@types/unist": "@types/unist@3.0.3", + "unist-util-is": "unist-util-is@6.0.0" } }, - "wrap-ansi@7.0.0": { - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "unist-util-visit@5.0.0": { + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", "dependencies": { - "ansi-styles": "ansi-styles@4.3.0", - "string-width": "string-width@4.2.3", - "strip-ansi": "strip-ansi@6.0.1" + "@types/unist": "@types/unist@3.0.3", + "unist-util-is": "unist-util-is@6.0.0", + "unist-util-visit-parents": "unist-util-visit-parents@6.0.1" } }, - "wrappy@1.0.2": { - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dependencies": {} + "vfile-message@4.0.2": { + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "unist-util-stringify-position": "unist-util-stringify-position@4.0.0" + } }, - "y18n@5.0.8": { - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dependencies": {} + "vfile@6.0.3": { + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "vfile-message": "vfile-message@4.0.2" + } }, "yaml@2.5.1": { "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", "dependencies": {} }, - "yargs-parser@20.2.9": { - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "zwitch@2.0.4": { + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", "dependencies": {} - }, - "yargs@16.2.0": { - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dependencies": { - "cliui": "cliui@7.0.4", - "escalade": "escalade@3.1.2", - "get-caller-file": "get-caller-file@2.0.5", - "require-directory": "require-directory@2.1.1", - "string-width": "string-width@4.2.3", - "y18n": "y18n@5.0.8", - "yargs-parser": "yargs-parser@20.2.9" - } } } }, @@ -1142,7 +592,7 @@ }, "workspace": { "dependencies": [ - "jsr:@deno/dnt@^0.41.2", + "jsr:@deno/dnt@^0.41.3", "jsr:@std/assert@^1.0.0", "jsr:@std/fs@^1.0.0", "jsr:@std/jsonc@^1.0.0", diff --git a/flake.nix b/flake.nix index e18baa4..650b312 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ # can't use slim here as long as we still publish with npm. # TODO(@joscha) change this once we only publish to jsr only nodejs_20 - jre + # jre openapi-generator-cli yamllint yamlfmt diff --git a/src/v2/generated/.gitattributes b/src/v2/generated/.gitattributes deleted file mode 100644 index 7bf5a17..0000000 --- a/src/v2/generated/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -**/* linguist-generated -*.md linguist-documentation - -.gitattributes text -.gitattributes export-ignore - -.gitignore text -.gitignore export-ignore diff --git a/src/v2/generated/.gitignore b/src/v2/generated/.gitignore deleted file mode 100644 index 1521c8b..0000000 --- a/src/v2/generated/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/src/v2/generated/.openapi-generator-ignore b/src/v2/generated/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/src/v2/generated/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/v2/generated/.openapi-generator/FILES b/src/v2/generated/.openapi-generator/FILES deleted file mode 100644 index ff23f31..0000000 --- a/src/v2/generated/.openapi-generator/FILES +++ /dev/null @@ -1,107 +0,0 @@ -.gitattributes -.gitignore -.openapi-generator-ignore -AuthApi.md -CompaniesApi.md -ListsApi.md -OpportunitiesApi.md -PersonsApi.md -apis/AuthApi.ts -apis/CompaniesApi.ts -apis/ListsApi.ts -apis/OpportunitiesApi.ts -apis/PersonsApi.ts -apis/baseapi.ts -apis/exception.ts -auth/auth.ts -configuration.ts -git_push.sh -http/http.ts -http/isomorphic-fetch.ts -index.ts -middleware.ts -models/Attendee.ts -models/AuthenticationError.ts -models/AuthenticationErrors.ts -models/AuthorizationError.ts -models/AuthorizationErrors.ts -models/ChatMessage.ts -models/CompaniesValue.ts -models/Company.ts -models/CompanyData.ts -models/CompanyListEntry.ts -models/CompanyPaged.ts -models/CompanyValue.ts -models/ConflictError.ts -models/DateValue.ts -models/Dropdown.ts -models/DropdownValue.ts -models/DropdownsValue.ts -models/Email.ts -models/EmptyMessageBodyError.ts -models/Errors.ts -models/Field.ts -models/FieldMetadata.ts -models/FieldMetadataPaged.ts -models/FieldValue.ts -models/FloatValue.ts -models/FloatsValue.ts -models/FormulaNumber.ts -models/FormulaValue.ts -models/GenericError.ts -models/Grant.ts -models/Interaction.ts -models/InteractionValue.ts -models/InvalidAcceptHeaderError.ts -models/InvalidMessageBodyError.ts -models/InvalidVersionHeaderError.ts -models/List.ts -models/ListEntry.ts -models/ListEntryPaged.ts -models/ListEntryWithEntity.ts -models/ListEntryWithEntityPaged.ts -models/ListPaged.ts -models/ListWithType.ts -models/ListWithTypePaged.ts -models/Location.ts -models/LocationValue.ts -models/LocationsValue.ts -models/Meeting.ts -models/MethodNotAllowedError.ts -models/ModelError.ts -models/NotFoundError.ts -models/NotFoundErrors.ts -models/ObjectSerializer.ts -models/Opportunity.ts -models/OpportunityListEntry.ts -models/OpportunityPaged.ts -models/OpportunityWithFields.ts -models/Pagination.ts -models/Person.ts -models/PersonData.ts -models/PersonListEntry.ts -models/PersonPaged.ts -models/PersonValue.ts -models/PersonsValue.ts -models/PhoneCall.ts -models/RankedDropdown.ts -models/RankedDropdownValue.ts -models/RateLimitError.ts -models/SavedView.ts -models/SavedViewPaged.ts -models/ServerError.ts -models/Tenant.ts -models/TextValue.ts -models/TextsValue.ts -models/TooManyMultipartFilesError.ts -models/User.ts -models/ValidationError.ts -models/ValidationErrors.ts -models/WhoAmI.ts -models/all.ts -rxjsStub.ts -servers.ts -types/ObjectParamAPI.ts -types/ObservableAPI.ts -types/PromiseAPI.ts -util.ts diff --git a/src/v2/generated/.openapi-generator/VERSION b/src/v2/generated/.openapi-generator/VERSION deleted file mode 100644 index 17f2442..0000000 --- a/src/v2/generated/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.9.0-SNAPSHOT diff --git a/src/v2/generated/AuthApi.md b/src/v2/generated/AuthApi.md deleted file mode 100644 index c36fb50..0000000 --- a/src/v2/generated/AuthApi.md +++ /dev/null @@ -1,58 +0,0 @@ -# Affinity.AuthApi - -All URIs are relative to *https://api.affinity.co* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getV2AuthWhoami**](AuthApi.md#getV2AuthWhoami) | **GET** /v2/auth/whoami | Get current user - - -# **getV2AuthWhoami** -> WhoAmI getV2AuthWhoami() - -Returns metadata about the current user. - -### Example - - -```typescript -import { createConfiguration, AuthApi } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new AuthApi(configuration); - -const request = {}; - -const data = await apiInstance.getV2AuthWhoami(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters -This endpoint does not need any parameter. - - -### Return type - -**WhoAmI** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get current user | - | -**401** | Unauthorized | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - - diff --git a/src/v2/generated/CompaniesApi.md b/src/v2/generated/CompaniesApi.md deleted file mode 100644 index 0104823..0000000 --- a/src/v2/generated/CompaniesApi.md +++ /dev/null @@ -1,333 +0,0 @@ -# Affinity.CompaniesApi - -All URIs are relative to *https://api.affinity.co* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getV2Companies**](CompaniesApi.md#getV2Companies) | **GET** /v2/companies | Get all Companies -[**getV2CompaniesFields**](CompaniesApi.md#getV2CompaniesFields) | **GET** /v2/companies/fields | Get metadata on Company Fields -[**getV2CompaniesId**](CompaniesApi.md#getV2CompaniesId) | **GET** /v2/companies/{id} | Get a single Company -[**getV2CompaniesIdListEntries**](CompaniesApi.md#getV2CompaniesIdListEntries) | **GET** /v2/companies/{id}/list-entries | Get a Company\'s List Entries -[**getV2CompaniesIdLists**](CompaniesApi.md#getV2CompaniesIdLists) | **GET** /v2/companies/{id}/lists | Get a Company\'s Lists - - -# **getV2Companies** -> CompanyPaged getV2Companies() - -Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; -import type { CompaniesApiGetV2CompaniesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new CompaniesApi(configuration); - -const request: CompaniesApiGetV2CompaniesRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, - // Company IDs (optional) - ids: [ - 1, - ], - // Field IDs for which to return field data (optional) - fieldIds: [ - "fieldIds_example", - ], - // Field Types for which to return field data (optional) - fieldTypes: [ - "enriched", - ], -}; - -const data = await apiInstance.getV2Companies(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - **ids** | **Array<number>** | Company IDs | (optional) defaults to undefined - **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined - **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined - - -### Return type - -**CompanyPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get all Companies | - | -**400** | Bad Request | - | -**403** | Forbidden | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2CompaniesFields** -> FieldMetadataPaged getV2CompaniesFields() - -Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - -### Example - - -```typescript -import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; -import type { CompaniesApiGetV2CompaniesFieldsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new CompaniesApi(configuration); - -const request: CompaniesApiGetV2CompaniesFieldsRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2CompaniesFields(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**FieldMetadataPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on Company Fields | - | -**400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2CompaniesId** -> Company getV2CompaniesId() - -Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; -import type { CompaniesApiGetV2CompaniesIdRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new CompaniesApi(configuration); - -const request: CompaniesApiGetV2CompaniesIdRequest = { - // Company ID - id: 1, - // Field IDs for which to return field data (optional) - fieldIds: [ - "fieldIds_example", - ], - // Field Types for which to return field data (optional) - fieldTypes: [ - "enriched", - ], -}; - -const data = await apiInstance.getV2CompaniesId(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Company ID | defaults to undefined - **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined - **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined - - -### Return type - -**Company** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a single Company | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2CompaniesIdListEntries** -> ListEntryPaged getV2CompaniesIdListEntries() - -Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; -import type { CompaniesApiGetV2CompaniesIdListEntriesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new CompaniesApi(configuration); - -const request: CompaniesApiGetV2CompaniesIdListEntriesRequest = { - // Company ID - id: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2CompaniesIdListEntries(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Company ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListEntryPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a Company\'s List Entries | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2CompaniesIdLists** -> ListPaged getV2CompaniesIdLists() - -Returns metadata for all the Lists on which the given Company appears. - -### Example - - -```typescript -import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; -import type { CompaniesApiGetV2CompaniesIdListsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new CompaniesApi(configuration); - -const request: CompaniesApiGetV2CompaniesIdListsRequest = { - // Company ID - id: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2CompaniesIdLists(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Company ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a Company\'s Lists | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - - diff --git a/src/v2/generated/ListsApi.md b/src/v2/generated/ListsApi.md deleted file mode 100644 index 9de2695..0000000 --- a/src/v2/generated/ListsApi.md +++ /dev/null @@ -1,445 +0,0 @@ -# Affinity.ListsApi - -All URIs are relative to *https://api.affinity.co* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getV2Lists**](ListsApi.md#getV2Lists) | **GET** /v2/lists | Get metadata on all Lists -[**getV2ListsListid**](ListsApi.md#getV2ListsListid) | **GET** /v2/lists/{listId} | Get metadata on a single List -[**getV2ListsListidFields**](ListsApi.md#getV2ListsListidFields) | **GET** /v2/lists/{listId}/fields | Get metadata on a single List\'s Fields -[**getV2ListsListidListEntries**](ListsApi.md#getV2ListsListidListEntries) | **GET** /v2/lists/{listId}/list-entries | Get all List Entries on a List -[**getV2ListsListidSavedViews**](ListsApi.md#getV2ListsListidSavedViews) | **GET** /v2/lists/{listId}/saved-views | Get metadata on Saved Views -[**getV2ListsListidSavedViewsViewid**](ListsApi.md#getV2ListsListidSavedViewsViewid) | **GET** /v2/lists/{listId}/saved-views/{viewId} | Get metadata on a single Saved View -[**getV2ListsListidSavedViewsViewidListEntries**](ListsApi.md#getV2ListsListidSavedViewsViewidListEntries) | **GET** /v2/lists/{listId}/saved-views/{viewId}/list-entries | Get all List Entries on a Saved View - - -# **getV2Lists** -> ListWithTypePaged getV2Lists() - -Returns metadata on Lists. - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2Lists(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListWithTypePaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on all Lists | - | -**400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListid** -> ListWithType getV2ListsListid() - -Returns metadata on a single List. - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidRequest = { - // List ID - listId: 1, -}; - -const data = await apiInstance.getV2ListsListid(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - - -### Return type - -**ListWithType** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on a single List | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListidFields** -> FieldMetadataPaged getV2ListsListidFields() - -Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidFieldsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidFieldsRequest = { - // List ID - listId: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2ListsListidFields(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**FieldMetadataPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on a single List\'s Fields | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListidListEntries** -> ListEntryWithEntityPaged getV2ListsListidListEntries() - -Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidListEntriesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidListEntriesRequest = { - // List ID - listId: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, - // Field IDs for which to return field data (optional) - fieldIds: [ - "fieldIds_example", - ], - // Field Types for which to return field data (optional) - fieldTypes: [ - "enriched", - ], -}; - -const data = await apiInstance.getV2ListsListidListEntries(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined - **fieldTypes** | **Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined - - -### Return type - -**ListEntryWithEntityPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get all List Entries on a List | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListidSavedViews** -> SavedViewPaged getV2ListsListidSavedViews() - -Returns metadata on the Saved Views on a List. - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidSavedViewsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidSavedViewsRequest = { - // List ID - listId: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2ListsListidSavedViews(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**SavedViewPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on Saved Views | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListidSavedViewsViewid** -> SavedView getV2ListsListidSavedViewsViewid() - -Returns metadata on a single Saved View. - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidSavedViewsViewidRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidSavedViewsViewidRequest = { - // List ID - listId: 1, - // Saved view ID - viewId: 1, -}; - -const data = await apiInstance.getV2ListsListidSavedViewsViewid(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - **viewId** | [**number**] | Saved view ID | defaults to undefined - - -### Return type - -**SavedView** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on a single Saved View | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2ListsListidSavedViewsViewidListEntries** -> ListEntryWithEntityPaged getV2ListsListidSavedViewsViewidListEntries() - -Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; -import type { ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new ListsApi(configuration); - -const request: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest = { - // List ID - listId: 1, - // Saved view ID - viewId: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2ListsListidSavedViewsViewidListEntries(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **listId** | [**number**] | List ID | defaults to undefined - **viewId** | [**number**] | Saved view ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListEntryWithEntityPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get all List Entries on a Saved View | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - - diff --git a/src/v2/generated/OpportunitiesApi.md b/src/v2/generated/OpportunitiesApi.md deleted file mode 100644 index 1b692ad..0000000 --- a/src/v2/generated/OpportunitiesApi.md +++ /dev/null @@ -1,130 +0,0 @@ -# Affinity.OpportunitiesApi - -All URIs are relative to *https://api.affinity.co* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getV2Opportunities**](OpportunitiesApi.md#getV2Opportunities) | **GET** /v2/opportunities | Get all Opportunities -[**getV2OpportunitiesId**](OpportunitiesApi.md#getV2OpportunitiesId) | **GET** /v2/opportunities/{id} | Get a single Opportunity - - -# **getV2Opportunities** -> OpportunityPaged getV2Opportunities() - -Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, OpportunitiesApi } from '@planet-a/affinity-node/v2'; -import type { OpportunitiesApiGetV2OpportunitiesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new OpportunitiesApi(configuration); - -const request: OpportunitiesApiGetV2OpportunitiesRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, - // Opportunity IDs (optional) - ids: [ - 1, - ], -}; - -const data = await apiInstance.getV2Opportunities(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - **ids** | **Array<number>** | Opportunity IDs | (optional) defaults to undefined - - -### Return type - -**OpportunityPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get all Opportunities | - | -**400** | Bad Request | - | -**403** | Forbidden | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2OpportunitiesId** -> Opportunity getV2OpportunitiesId() - -Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, OpportunitiesApi } from '@planet-a/affinity-node/v2'; -import type { OpportunitiesApiGetV2OpportunitiesIdRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new OpportunitiesApi(configuration); - -const request: OpportunitiesApiGetV2OpportunitiesIdRequest = { - // Opportunity ID - id: 1, -}; - -const data = await apiInstance.getV2OpportunitiesId(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Opportunity ID | defaults to undefined - - -### Return type - -**Opportunity** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a single Opportunity | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - - diff --git a/src/v2/generated/PersonsApi.md b/src/v2/generated/PersonsApi.md deleted file mode 100644 index 5038882..0000000 --- a/src/v2/generated/PersonsApi.md +++ /dev/null @@ -1,333 +0,0 @@ -# Affinity.PersonsApi - -All URIs are relative to *https://api.affinity.co* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getV2Persons**](PersonsApi.md#getV2Persons) | **GET** /v2/persons | Get all Persons -[**getV2PersonsFields**](PersonsApi.md#getV2PersonsFields) | **GET** /v2/persons/fields | Get metadata on Person Fields -[**getV2PersonsId**](PersonsApi.md#getV2PersonsId) | **GET** /v2/persons/{id} | Get a single Person -[**getV2PersonsIdListEntries**](PersonsApi.md#getV2PersonsIdListEntries) | **GET** /v2/persons/{id}/list-entries | Get a Person\'s List Entries -[**getV2PersonsIdLists**](PersonsApi.md#getV2PersonsIdLists) | **GET** /v2/persons/{id}/lists | Get a Person\'s Lists - - -# **getV2Persons** -> PersonPaged getV2Persons() - -Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; -import type { PersonsApiGetV2PersonsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new PersonsApi(configuration); - -const request: PersonsApiGetV2PersonsRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, - // People IDs (optional) - ids: [ - 1, - ], - // Field IDs for which to return field data (optional) - fieldIds: [ - "fieldIds_example", - ], - // Field Types for which to return field data (optional) - fieldTypes: [ - "enriched", - ], -}; - -const data = await apiInstance.getV2Persons(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - **ids** | **Array<number>** | People IDs | (optional) defaults to undefined - **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined - **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined - - -### Return type - -**PersonPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get all Persons | - | -**400** | Bad Request | - | -**403** | Forbidden | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2PersonsFields** -> FieldMetadataPaged getV2PersonsFields() - -Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - -### Example - - -```typescript -import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; -import type { PersonsApiGetV2PersonsFieldsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new PersonsApi(configuration); - -const request: PersonsApiGetV2PersonsFieldsRequest = { - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2PersonsFields(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**FieldMetadataPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get metadata on Person Fields | - | -**400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2PersonsId** -> Person getV2PersonsId() - -Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; -import type { PersonsApiGetV2PersonsIdRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new PersonsApi(configuration); - -const request: PersonsApiGetV2PersonsIdRequest = { - // Person ID - id: 1, - // Field IDs for which to return field data (optional) - fieldIds: [ - "fieldIds_example", - ], - // Field Types for which to return field data (optional) - fieldTypes: [ - "enriched", - ], -}; - -const data = await apiInstance.getV2PersonsId(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Person ID | defaults to undefined - **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined - **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined - - -### Return type - -**Person** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a single Person | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2PersonsIdListEntries** -> ListEntryPaged getV2PersonsIdListEntries() - -Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - -### Example - - -```typescript -import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; -import type { PersonsApiGetV2PersonsIdListEntriesRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new PersonsApi(configuration); - -const request: PersonsApiGetV2PersonsIdListEntriesRequest = { - // Persons ID - id: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2PersonsIdListEntries(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Persons ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListEntryPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a Person\'s List Entries | - | -**400** | Bad Request | - | -**403** | Forbidden | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getV2PersonsIdLists** -> ListPaged getV2PersonsIdLists() - -Returns metadata for all the Lists on which the given Person appears. - -### Example - - -```typescript -import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; -import type { PersonsApiGetV2PersonsIdListsRequest } from '@planet-a/affinity-node/v2'; - -const configuration = createConfiguration(); -const apiInstance = new PersonsApi(configuration); - -const request: PersonsApiGetV2PersonsIdListsRequest = { - // Persons ID - id: 1, - // Cursor for the next or previous page (optional) - cursor: "cursor_example", - // Number of items to include in the page (optional) - limit: 100, -}; - -const data = await apiInstance.getV2PersonsIdLists(request); -console.log('API called successfully. Returned data:', data); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | [**number**] | Persons ID | defaults to undefined - **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined - **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 - - -### Return type - -**ListPaged** - -### Authorization - -[bearerAuth](README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get a Person\'s Lists | - | -**400** | Bad Request | - | -**404** | Not Found | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - - diff --git a/src/v2/generated/apis/AuthApi.ts b/src/v2/generated/apis/AuthApi.ts deleted file mode 100644 index 2fb613d..0000000 --- a/src/v2/generated/apis/AuthApi.ts +++ /dev/null @@ -1,97 +0,0 @@ -// TODO: better import syntax? -import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; -import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; -import {ObjectSerializer} from '../models/ObjectSerializer.ts'; -import {ApiException} from './exception.ts'; -import {canConsumeForm, isCodeInRange} from '../util.ts'; -import {SecurityAuthentication} from '../auth/auth.ts'; - - -import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { WhoAmI } from '../models/WhoAmI.ts'; - -/** - * no description - */ -export class AuthApiRequestFactory extends BaseAPIRequestFactory { - - /** - * Returns metadata about the current user. - * Get current user - */ - public async getV2AuthWhoami(_options?: Configuration): Promise { - let _config = _options || this.configuration; - - // Path Params - const localVarPath = '/v2/auth/whoami'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - -} - -export class AuthApiResponseProcessor { - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2AuthWhoami - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2AuthWhoamiWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: WhoAmI = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "WhoAmI", "" - ) as WhoAmI; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("401", response.httpStatusCode)) { - const body: AuthenticationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthenticationErrors", "" - ) as AuthenticationErrors; - throw new ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: WhoAmI = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "WhoAmI", "" - ) as WhoAmI; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - -} diff --git a/src/v2/generated/apis/CompaniesApi.ts b/src/v2/generated/apis/CompaniesApi.ts deleted file mode 100644 index 75826ab..0000000 --- a/src/v2/generated/apis/CompaniesApi.ts +++ /dev/null @@ -1,531 +0,0 @@ -// TODO: better import syntax? -import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; -import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; -import {ObjectSerializer} from '../models/ObjectSerializer.ts'; -import {ApiException} from './exception.ts'; -import {canConsumeForm, isCodeInRange} from '../util.ts'; -import {SecurityAuthentication} from '../auth/auth.ts'; - - -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { Company } from '../models/Company.ts'; -import { CompanyPaged } from '../models/CompanyPaged.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; - -/** - * no description - */ -export class CompaniesApiRequestFactory extends BaseAPIRequestFactory { - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - * @param ids Company IDs - * @param fieldIds Field IDs for which to return field data - * @param fieldTypes Field Types for which to return field data - */ - public async getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - - - - // Path Params - const localVarPath = '/v2/companies'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (ids !== undefined) { - const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("ids", serializedParam); - } - } - - // Query Params - if (fieldIds !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldIds", serializedParam); - } - } - - // Query Params - if (fieldTypes !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldTypes", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - // Path Params - const localVarPath = '/v2/companies/fields'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param id Company ID - * @param fieldIds Field IDs for which to return field data - * @param fieldTypes Field Types for which to return field data - */ - public async getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("CompaniesApi", "getV2CompaniesId", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/companies/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (fieldIds !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldIds", serializedParam); - } - } - - // Query Params - if (fieldTypes !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldTypes", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param id Company ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("CompaniesApi", "getV2CompaniesIdListEntries", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/companies/{id}/list-entries' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param id Company ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("CompaniesApi", "getV2CompaniesIdLists", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/companies/{id}/lists' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - -} - -export class CompaniesApiResponseProcessor { - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2Companies - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2CompaniesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: CompanyPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "CompanyPaged", "" - ) as CompanyPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CompanyPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "CompanyPaged", "" - ) as CompanyPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2CompaniesFields - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2CompaniesFieldsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2CompaniesId - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2CompaniesIdWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: Company = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Company", "" - ) as Company; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: Company = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Company", "" - ) as Company; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2CompaniesIdListEntries - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2CompaniesIdListEntriesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListEntryPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryPaged", "" - ) as ListEntryPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListEntryPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryPaged", "" - ) as ListEntryPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2CompaniesIdLists - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2CompaniesIdListsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListPaged", "" - ) as ListPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListPaged", "" - ) as ListPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - -} diff --git a/src/v2/generated/apis/ListsApi.ts b/src/v2/generated/apis/ListsApi.ts deleted file mode 100644 index 18e13a4..0000000 --- a/src/v2/generated/apis/ListsApi.ts +++ /dev/null @@ -1,702 +0,0 @@ -// TODO: better import syntax? -import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; -import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; -import {ObjectSerializer} from '../models/ObjectSerializer.ts'; -import {ApiException} from './exception.ts'; -import {canConsumeForm, isCodeInRange} from '../util.ts'; -import {SecurityAuthentication} from '../auth/auth.ts'; - - -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; -import { ListWithType } from '../models/ListWithType.ts'; -import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { SavedView } from '../models/SavedView.ts'; -import { SavedViewPaged } from '../models/SavedViewPaged.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; - -/** - * no description - */ -export class ListsApiRequestFactory extends BaseAPIRequestFactory { - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - // Path Params - const localVarPath = '/v2/lists'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param listId List ID - */ - public async getV2ListsListid(listId: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListid", "listId"); - } - - - // Path Params - const localVarPath = '/v2/lists/{listId}' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param listId List ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidFields", "listId"); - } - - - - - // Path Params - const localVarPath = '/v2/lists/{listId}/fields' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param listId List ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - * @param fieldIds Field IDs for which to return field data - * @param fieldTypes Field Types for which to return field data - */ - public async getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidListEntries", "listId"); - } - - - - - - - // Path Params - const localVarPath = '/v2/lists/{listId}/list-entries' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (fieldIds !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldIds", serializedParam); - } - } - - // Query Params - if (fieldTypes !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldTypes", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param listId List ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidSavedViews", "listId"); - } - - - - - // Path Params - const localVarPath = '/v2/lists/{listId}/saved-views' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param listId List ID - * @param viewId Saved view ID - */ - public async getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewid", "listId"); - } - - - // verify required parameter 'viewId' is not null or undefined - if (viewId === null || viewId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewid", "viewId"); - } - - - // Path Params - const localVarPath = '/v2/lists/{listId}/saved-views/{viewId}' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))) - .replace('{' + 'viewId' + '}', encodeURIComponent(String(viewId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param listId List ID - * @param viewId Saved view ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'listId' is not null or undefined - if (listId === null || listId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewidListEntries", "listId"); - } - - - // verify required parameter 'viewId' is not null or undefined - if (viewId === null || viewId === undefined) { - throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewidListEntries", "viewId"); - } - - - - - // Path Params - const localVarPath = '/v2/lists/{listId}/saved-views/{viewId}/list-entries' - .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))) - .replace('{' + 'viewId' + '}', encodeURIComponent(String(viewId))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - -} - -export class ListsApiResponseProcessor { - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2Lists - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListWithTypePaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListWithTypePaged", "" - ) as ListWithTypePaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListWithTypePaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListWithTypePaged", "" - ) as ListWithTypePaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListid - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListWithType = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListWithType", "" - ) as ListWithType; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListWithType = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListWithType", "" - ) as ListWithType; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListidFields - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidFieldsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListidListEntries - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidListEntriesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryWithEntityPaged", "" - ) as ListEntryWithEntityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryWithEntityPaged", "" - ) as ListEntryWithEntityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListidSavedViews - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidSavedViewsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: SavedViewPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "SavedViewPaged", "" - ) as SavedViewPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: SavedViewPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "SavedViewPaged", "" - ) as SavedViewPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListidSavedViewsViewid - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidSavedViewsViewidWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: SavedView = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "SavedView", "" - ) as SavedView; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: SavedView = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "SavedView", "" - ) as SavedView; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2ListsListidSavedViewsViewidListEntries - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryWithEntityPaged", "" - ) as ListEntryWithEntityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryWithEntityPaged", "" - ) as ListEntryWithEntityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - -} diff --git a/src/v2/generated/apis/OpportunitiesApi.ts b/src/v2/generated/apis/OpportunitiesApi.ts deleted file mode 100644 index 3029969..0000000 --- a/src/v2/generated/apis/OpportunitiesApi.ts +++ /dev/null @@ -1,211 +0,0 @@ -// TODO: better import syntax? -import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; -import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; -import {ObjectSerializer} from '../models/ObjectSerializer.ts'; -import {ApiException} from './exception.ts'; -import {canConsumeForm, isCodeInRange} from '../util.ts'; -import {SecurityAuthentication} from '../auth/auth.ts'; - - -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Opportunity } from '../models/Opportunity.ts'; -import { OpportunityPaged } from '../models/OpportunityPaged.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; - -/** - * no description - */ -export class OpportunitiesApiRequestFactory extends BaseAPIRequestFactory { - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - * @param ids Opportunity IDs - */ - public async getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - - // Path Params - const localVarPath = '/v2/opportunities'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (ids !== undefined) { - const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("ids", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param id Opportunity ID - */ - public async getV2OpportunitiesId(id: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("OpportunitiesApi", "getV2OpportunitiesId", "id"); - } - - - // Path Params - const localVarPath = '/v2/opportunities/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - -} - -export class OpportunitiesApiResponseProcessor { - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2Opportunities - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2OpportunitiesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: OpportunityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "OpportunityPaged", "" - ) as OpportunityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: OpportunityPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "OpportunityPaged", "" - ) as OpportunityPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2OpportunitiesId - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2OpportunitiesIdWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: Opportunity = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Opportunity", "" - ) as Opportunity; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: Opportunity = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Opportunity", "" - ) as Opportunity; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - -} diff --git a/src/v2/generated/apis/PersonsApi.ts b/src/v2/generated/apis/PersonsApi.ts deleted file mode 100644 index 5350746..0000000 --- a/src/v2/generated/apis/PersonsApi.ts +++ /dev/null @@ -1,531 +0,0 @@ -// TODO: better import syntax? -import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; -import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; -import {ObjectSerializer} from '../models/ObjectSerializer.ts'; -import {ApiException} from './exception.ts'; -import {canConsumeForm, isCodeInRange} from '../util.ts'; -import {SecurityAuthentication} from '../auth/auth.ts'; - - -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Person } from '../models/Person.ts'; -import { PersonPaged } from '../models/PersonPaged.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; - -/** - * no description - */ -export class PersonsApiRequestFactory extends BaseAPIRequestFactory { - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - * @param ids People IDs - * @param fieldIds Field IDs for which to return field data - * @param fieldTypes Field Types for which to return field data - */ - public async getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - - - - // Path Params - const localVarPath = '/v2/persons'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - // Query Params - if (ids !== undefined) { - const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("ids", serializedParam); - } - } - - // Query Params - if (fieldIds !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldIds", serializedParam); - } - } - - // Query Params - if (fieldTypes !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldTypes", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - - - // Path Params - const localVarPath = '/v2/persons/fields'; - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param id Person ID - * @param fieldIds Field IDs for which to return field data - * @param fieldTypes Field Types for which to return field data - */ - public async getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("PersonsApi", "getV2PersonsId", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/persons/{id}' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (fieldIds !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldIds", serializedParam); - } - } - - // Query Params - if (fieldTypes !== undefined) { - const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); - for (const serializedParam of serializedParams) { - requestContext.appendQueryParam("fieldTypes", serializedParam); - } - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param id Persons ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("PersonsApi", "getV2PersonsIdListEntries", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/persons/{id}/list-entries' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param id Persons ID - * @param cursor Cursor for the next or previous page - * @param limit Number of items to include in the page - */ - public async getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - let _config = _options || this.configuration; - - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError("PersonsApi", "getV2PersonsIdLists", "id"); - } - - - - - // Path Params - const localVarPath = '/v2/persons/{id}/lists' - .replace('{' + 'id' + '}', encodeURIComponent(String(id))); - - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - - // Query Params - if (cursor !== undefined) { - requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); - } - - // Query Params - if (limit !== undefined) { - requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); - } - - - let authMethod: SecurityAuthentication | undefined; - // Apply auth methods - authMethod = _config.authMethods["bearerAuth"] - if (authMethod?.applySecurityAuthentication) { - await authMethod?.applySecurityAuthentication(requestContext); - } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); - } - - return requestContext; - } - -} - -export class PersonsApiResponseProcessor { - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2Persons - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2PersonsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: PersonPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "PersonPaged", "" - ) as PersonPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: PersonPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "PersonPaged", "" - ) as PersonPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2PersonsFields - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2PersonsFieldsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: FieldMetadataPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "FieldMetadataPaged", "" - ) as FieldMetadataPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2PersonsId - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2PersonsIdWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: Person = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Person", "" - ) as Person; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: Person = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "Person", "" - ) as Person; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2PersonsIdListEntries - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2PersonsIdListEntriesWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListEntryPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryPaged", "" - ) as ListEntryPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("403", response.httpStatusCode)) { - const body: AuthorizationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "AuthorizationErrors", "" - ) as AuthorizationErrors; - throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListEntryPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListEntryPaged", "" - ) as ListEntryPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to getV2PersonsIdLists - * @throws ApiException if the response code was not in [200, 299] - */ - public async getV2PersonsIdListsWithHttpInfo(response: ResponseContext): Promise> { - const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); - if (isCodeInRange("200", response.httpStatusCode)) { - const body: ListPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListPaged", "" - ) as ListPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - if (isCodeInRange("400", response.httpStatusCode)) { - const body: ValidationErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ValidationErrors", "" - ) as ValidationErrors; - throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); - } - if (isCodeInRange("404", response.httpStatusCode)) { - const body: NotFoundErrors = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "NotFoundErrors", "" - ) as NotFoundErrors; - throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListPaged = ObjectSerializer.deserialize( - ObjectSerializer.parse(await response.body.text(), contentType), - "ListPaged", "" - ) as ListPaged; - return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); - } - - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); - } - -} diff --git a/src/v2/generated/apis/baseapi.ts b/src/v2/generated/apis/baseapi.ts deleted file mode 100644 index 46ed74b..0000000 --- a/src/v2/generated/apis/baseapi.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Configuration } from '../configuration.ts' - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPIRequestFactory { - - constructor(protected configuration: Configuration) { - } -}; - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; - constructor(public api: string, public method: string, public field: string) { - super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); - } -} diff --git a/src/v2/generated/apis/exception.ts b/src/v2/generated/apis/exception.ts deleted file mode 100644 index 9365d33..0000000 --- a/src/v2/generated/apis/exception.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Represents an error caused by an api call i.e. it has attributes for a HTTP status code - * and the returned body object. - * - * Example - * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] - * => ApiException(404, someErrorMessageObject) - * - */ -export class ApiException extends Error { - public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { - super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + - JSON.stringify(headers)) - } -} diff --git a/src/v2/generated/auth/auth.ts b/src/v2/generated/auth/auth.ts deleted file mode 100644 index 8763a5a..0000000 --- a/src/v2/generated/auth/auth.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { RequestContext } from "../http/http.ts"; - -/** - * Interface authentication schemes. - */ -export interface SecurityAuthentication { - /* - * @return returns the name of the security authentication as specified in OAI - */ - getName(): string; - - /** - * Applies the authentication scheme to the request context - * - * @params context the request context which should use this authentication scheme - */ - applySecurityAuthentication(context: RequestContext): void | Promise; -} - -export interface TokenProvider { - getToken(): Promise | string; -} - -/** - * Applies http authentication to the request context. - */ -export class BearerAuthAuthentication implements SecurityAuthentication { - /** - * Configures the http authentication with the required details. - * - * @param tokenProvider service that can provide the up-to-date token when needed - */ - public constructor(private tokenProvider: TokenProvider) {} - - public getName(): string { - return "bearerAuth"; - } - - public async applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("Authorization", "Bearer " + await this.tokenProvider.getToken()); - } -} - - -export type AuthMethods = { - "default"?: SecurityAuthentication, - "bearerAuth"?: SecurityAuthentication -} - -export type ApiKeyConfiguration = string; -export type HttpBasicConfiguration = { "username": string, "password": string }; -export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; -export type OAuth2Configuration = { accessToken: string }; - -export type AuthMethodsConfiguration = { - "default"?: SecurityAuthentication, - "bearerAuth"?: HttpBearerConfiguration -} - -/** - * Creates the authentication methods from a swagger description. - * - */ -export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { - let authMethods: AuthMethods = {} - - if (!config) { - return authMethods; - } - authMethods["default"] = config["default"] - - if (config["bearerAuth"]) { - authMethods["bearerAuth"] = new BearerAuthAuthentication( - config["bearerAuth"]["tokenProvider"] - ); - } - - return authMethods; -} \ No newline at end of file diff --git a/src/v2/generated/configuration.ts b/src/v2/generated/configuration.ts deleted file mode 100644 index 0a170f0..0000000 --- a/src/v2/generated/configuration.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { HttpLibrary } from "./http/http.ts"; -import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware.ts"; -import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch.ts"; -import { BaseServerConfiguration, server1 } from "./servers.ts"; -import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth.ts"; - -export interface Configuration { - readonly baseServer: BaseServerConfiguration; - readonly httpApi: HttpLibrary; - readonly middleware: Middleware[]; - readonly authMethods: AuthMethods; -} - - -/** - * Interface with which a configuration object can be configured. - */ -export interface ConfigurationParameters { - /** - * Default server to use - a list of available servers (according to the - * OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also - * create your own server with the `ServerConfiguration` class from the same - * file. - */ - baseServer?: BaseServerConfiguration; - /** - * HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as - * all generators come with a default library. - * If available, additional libraries can be imported from `./http/*` - */ - httpApi?: HttpLibrary; - - /** - * The middlewares which will be applied to requests and responses. You can - * add any number of middleware components to modify requests before they - * are sent or before they are deserialized by implementing the `Middleware` - * interface defined in `./middleware` - */ - middleware?: Middleware[]; - /** - * Configures middleware functions that return promises instead of - * Observables (which are used by `middleware`). Otherwise allows for the - * same functionality as `middleware`, i.e., modifying requests before they - * are sent and before they are deserialized. - */ - promiseMiddleware?: PromiseMiddleware[]; - /** - * Configuration for the available authentication methods (e.g., api keys) - * according to the OpenAPI yaml definition. For the definition, please refer to - * `./auth/auth` - */ - authMethods?: AuthMethodsConfiguration -} - -/** - * Provide your `ConfigurationParameters` to this function to get a `Configuration` - * object that can be used to configure your APIs (in the constructor or - * for each request individually). - * - * If a property is not included in conf, a default is used: - * - baseServer: server1 - * - httpApi: IsomorphicFetchHttpLibrary - * - middleware: [] - * - promiseMiddleware: [] - * - authMethods: {} - * - * @param conf partial configuration - */ -export function createConfiguration(conf: ConfigurationParameters = {}): Configuration { - const configuration: Configuration = { - baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, - httpApi: conf.httpApi || new DefaultHttpLibrary(), - middleware: conf.middleware || [], - authMethods: configureAuthMethods(conf.authMethods) - }; - if (conf.promiseMiddleware) { - conf.promiseMiddleware.forEach( - m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) - ); - } - return configuration; -} \ No newline at end of file diff --git a/src/v2/generated/git_push.sh b/src/v2/generated/git_push.sh deleted file mode 100644 index b253029..0000000 --- a/src/v2/generated/git_push.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/src/v2/generated/http/http.ts b/src/v2/generated/http/http.ts deleted file mode 100644 index 231a58d..0000000 --- a/src/v2/generated/http/http.ts +++ /dev/null @@ -1,244 +0,0 @@ -import { Observable, from } from '../rxjsStub.ts'; - - -/** - * Represents an HTTP method. - */ -export enum HttpMethod { - GET = "GET", - HEAD = "HEAD", - POST = "POST", - PUT = "PUT", - DELETE = "DELETE", - CONNECT = "CONNECT", - OPTIONS = "OPTIONS", - TRACE = "TRACE", - PATCH = "PATCH" -} - -/** - * Represents an HTTP file which will be transferred from or to a server. - */ -export type HttpFile = Blob & { readonly name: string }; - -export class HttpException extends Error { - public constructor(msg: string) { - super(msg); - } -} - -/** - * Represents the body of an outgoing HTTP request. - */ -export type RequestBody = undefined | string | FormData | URLSearchParams; - -type Headers = Record; - -function ensureAbsoluteUrl(url: string) { - if (url.startsWith("http://") || url.startsWith("https://")) { - return url; - } - return window.location.origin + url; -} - -/** - * Represents an HTTP request context - */ -export class RequestContext { - private headers: Headers = {}; - private body: RequestBody = undefined; - private url: URL; - - /** - * Creates the request context using a http method and request resource url - * - * @param url url of the requested resource - * @param httpMethod http method - */ - public constructor(url: string, private httpMethod: HttpMethod) { - this.url = new URL(ensureAbsoluteUrl(url)); - } - - /* - * Returns the url set in the constructor including the query string - * - */ - public getUrl(): string { - return this.url.toString().endsWith("/") ? - this.url.toString().slice(0, -1) - : this.url.toString(); - } - - /** - * Replaces the url set in the constructor with this url. - * - */ - public setUrl(url: string) { - this.url = new URL(ensureAbsoluteUrl(url)); - } - - /** - * Sets the body of the http request either as a string or FormData - * - * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE - * request is discouraged. - * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 - * - * @param body the body of the request - */ - public setBody(body: RequestBody) { - this.body = body; - } - - public getHttpMethod(): HttpMethod { - return this.httpMethod; - } - - public getHeaders(): Headers { - return this.headers; - } - - public getBody(): RequestBody { - return this.body; - } - - public setQueryParam(name: string, value: string) { - this.url.searchParams.set(name, value); - } - - public appendQueryParam(name: string, value: string) { - this.url.searchParams.append(name, value); - } - - /** - * Sets a cookie with the name and value. NO check for duplicate cookies is performed - * - */ - public addCookie(name: string, value: string): void { - if (!this.headers["Cookie"]) { - this.headers["Cookie"] = ""; - } - this.headers["Cookie"] += name + "=" + value + "; "; - } - - public setHeaderParam(key: string, value: string): void { - this.headers[key] = value; - } -} - -export interface ResponseBody { - text(): Promise; - binary(): Promise; -} - -/** - * Helper class to generate a `ResponseBody` from binary data - */ -export class SelfDecodingBody implements ResponseBody { - constructor(private dataSource: Promise) {} - - binary(): Promise { - return this.dataSource; - } - - async text(): Promise { - const data: Blob = await this.dataSource; - return data.text(); - } -} - -export class ResponseContext { - public constructor( - public httpStatusCode: number, - public headers: Headers, - public body: ResponseBody - ) {} - - /** - * Parse header value in the form `value; param1="value1"` - * - * E.g. for Content-Type or Content-Disposition - * Parameter names are converted to lower case - * The first parameter is returned with the key `""` - */ - public getParsedHeader(headerName: string): Headers { - const result: Headers = {}; - if (!this.headers[headerName]) { - return result; - } - - const parameters = this.headers[headerName].split(";"); - for (const parameter of parameters) { - let [key, value] = parameter.split("=", 2); - key = key.toLowerCase().trim(); - if (value === undefined) { - result[""] = key; - } else { - value = value.trim(); - if (value.startsWith('"') && value.endsWith('"')) { - value = value.substring(1, value.length - 1); - } - result[key] = value; - } - } - return result; - } - - public async getBodyAsFile(): Promise { - const data = await this.body.binary(); - const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; - const contentType = this.headers["content-type"] || ""; - try { - return new File([data], fileName, { type: contentType }); - } catch (error) { - /** Fallback for when the File constructor is not available */ - return Object.assign(data, { - name: fileName, - type: contentType - }); - } - } - - /** - * Use a heuristic to get a body of unknown data structure. - * Return as string if possible, otherwise as binary. - */ - public getBodyAsAny(): Promise { - try { - return this.body.text(); - } catch {} - - try { - return this.body.binary(); - } catch {} - - return Promise.resolve(undefined); - } -} - -export interface HttpLibrary { - send(request: RequestContext): Observable; -} - -export interface PromiseHttpLibrary { - send(request: RequestContext): Promise; -} - -export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { - return { - send(request: RequestContext): Observable { - return from(promiseHttpLibrary.send(request)); - } - } -} - -export class HttpInfo extends ResponseContext { - public constructor( - public httpStatusCode: number, - public headers: Headers, - public body: ResponseBody, - public data: T, - ) { - super(httpStatusCode, headers, body); - } -} diff --git a/src/v2/generated/http/isomorphic-fetch.ts b/src/v2/generated/http/isomorphic-fetch.ts deleted file mode 100644 index a752135..0000000 --- a/src/v2/generated/http/isomorphic-fetch.ts +++ /dev/null @@ -1,30 +0,0 @@ -import {HttpLibrary, RequestContext, ResponseContext} from './http.ts'; -import { from, Observable } from '../rxjsStub.ts'; - -export class IsomorphicFetchHttpLibrary implements HttpLibrary { - - public send(request: RequestContext): Observable { - let method = request.getHttpMethod().toString(); - let body = request.getBody(); - - const resultPromise = fetch(request.getUrl(), { - method: method, - body: body as any, - headers: request.getHeaders(), - }).then((resp: any) => { - const headers: { [name: string]: string } = {}; - resp.headers.forEach((value: string, name: string) => { - headers[name] = value; - }); - - const body = { - text: () => resp.text(), - binary: () => resp.blob() - }; - return new ResponseContext(resp.status, headers, body); - }); - - return from>(resultPromise); - - } -} diff --git a/src/v2/generated/index.ts b/src/v2/generated/index.ts deleted file mode 100644 index a2f2c52..0000000 --- a/src/v2/generated/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from "./http/http.ts"; -export * from "./auth/auth.ts"; -export * from "./models/all.ts"; -export { createConfiguration } from "./configuration.ts" -export type { Configuration } from "./configuration.ts" -export * from "./apis/exception.ts"; -export * from "./servers.ts"; -export { RequiredError } from "./apis/baseapi.ts"; - -export type { PromiseMiddleware as Middleware } from './middleware.ts'; -export { type AuthApiGetV2AuthWhoamiRequest, ObjectAuthApi as AuthApi, type CompaniesApiGetV2CompaniesRequest, type CompaniesApiGetV2CompaniesFieldsRequest, type CompaniesApiGetV2CompaniesIdRequest, type CompaniesApiGetV2CompaniesIdListEntriesRequest, type CompaniesApiGetV2CompaniesIdListsRequest, ObjectCompaniesApi as CompaniesApi, type ListsApiGetV2ListsRequest, type ListsApiGetV2ListsListidRequest, type ListsApiGetV2ListsListidFieldsRequest, type ListsApiGetV2ListsListidListEntriesRequest, type ListsApiGetV2ListsListidSavedViewsRequest, type ListsApiGetV2ListsListidSavedViewsViewidRequest, type ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, ObjectListsApi as ListsApi, type OpportunitiesApiGetV2OpportunitiesRequest, type OpportunitiesApiGetV2OpportunitiesIdRequest, ObjectOpportunitiesApi as OpportunitiesApi, type PersonsApiGetV2PersonsRequest, type PersonsApiGetV2PersonsFieldsRequest, type PersonsApiGetV2PersonsIdRequest, type PersonsApiGetV2PersonsIdListEntriesRequest, type PersonsApiGetV2PersonsIdListsRequest, ObjectPersonsApi as PersonsApi } from './types/ObjectParamAPI.ts'; - diff --git a/src/v2/generated/middleware.ts b/src/v2/generated/middleware.ts deleted file mode 100644 index ae36e6c..0000000 --- a/src/v2/generated/middleware.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {RequestContext, ResponseContext} from './http/http.ts'; -import { Observable, from } from './rxjsStub.ts'; - -/** - * Defines the contract for a middleware intercepting requests before - * they are sent (but after the RequestContext was created) - * and before the ResponseContext is unwrapped. - * - */ -export interface Middleware { - /** - * Modifies the request before the request is sent. - * - * @param context RequestContext of a request which is about to be sent to the server - * @returns an observable of the updated request context - * - */ - pre(context: RequestContext): Observable; - /** - * Modifies the returned response before it is deserialized. - * - * @param context ResponseContext of a sent request - * @returns an observable of the modified response context - */ - post(context: ResponseContext): Observable; -} - -export class PromiseMiddlewareWrapper implements Middleware { - - public constructor(private middleware: PromiseMiddleware) { - - } - - pre(context: RequestContext): Observable { - return from(this.middleware.pre(context)); - } - - post(context: ResponseContext): Observable { - return from(this.middleware.post(context)); - } - -} - -/** - * Defines the contract for a middleware intercepting requests before - * they are sent (but after the RequestContext was created) - * and before the ResponseContext is unwrapped. - * - */ -export interface PromiseMiddleware { - /** - * Modifies the request before the request is sent. - * - * @param context RequestContext of a request which is about to be sent to the server - * @returns an observable of the updated request context - * - */ - pre(context: RequestContext): Promise; - /** - * Modifies the returned response before it is deserialized. - * - * @param context ResponseContext of a sent request - * @returns an observable of the modified response context - */ - post(context: ResponseContext): Promise; -} diff --git a/src/v2/generated/models/Attendee.ts b/src/v2/generated/models/Attendee.ts deleted file mode 100644 index 9aaa3ad..0000000 --- a/src/v2/generated/models/Attendee.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { PersonData } from '../models/PersonData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class Attendee { - /** - * The email addresses of the attendee - */ - 'emailAddress': string | null; - 'person': PersonData | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "emailAddress", - "baseName": "emailAddress", - "type": "string", - "format": "email" - }, - { - "name": "person", - "baseName": "person", - "type": "PersonData", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Attendee.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/AuthenticationError.ts b/src/v2/generated/models/AuthenticationError.ts deleted file mode 100644 index b9e388b..0000000 --- a/src/v2/generated/models/AuthenticationError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class AuthenticationError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return AuthenticationError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/AuthenticationErrors.ts b/src/v2/generated/models/AuthenticationErrors.ts deleted file mode 100644 index 9ed0150..0000000 --- a/src/v2/generated/models/AuthenticationErrors.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* AuthenticationErrors model -*/ -export class AuthenticationErrors { - /** - * AuthenticationError errors - */ - 'errors'?: Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "errors", - "baseName": "errors", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return AuthenticationErrors.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/AuthorizationError.ts b/src/v2/generated/models/AuthorizationError.ts deleted file mode 100644 index 6451aae..0000000 --- a/src/v2/generated/models/AuthorizationError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class AuthorizationError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return AuthorizationError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/AuthorizationErrors.ts b/src/v2/generated/models/AuthorizationErrors.ts deleted file mode 100644 index dd3f047..0000000 --- a/src/v2/generated/models/AuthorizationErrors.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* AuthorizationErrors model -*/ -export class AuthorizationErrors { - /** - * AuthorizationError errors - */ - 'errors'?: Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "errors", - "baseName": "errors", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return AuthorizationErrors.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ChatMessage.ts b/src/v2/generated/models/ChatMessage.ts deleted file mode 100644 index 57a9e9e..0000000 --- a/src/v2/generated/models/ChatMessage.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { PersonData } from '../models/PersonData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class ChatMessage { - /** - * The type of interaction - */ - 'type': ChatMessageTypeEnum; - /** - * The chat message\'s unique identifier - */ - 'id': number; - /** - * The direction of the chat message - */ - 'direction': ChatMessageDirectionEnum; - /** - * The time the chat message was sent - */ - 'sentAt': Date; - 'manualCreator': PersonData; - /** - * The participants of the chat - */ - 'participants': Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "ChatMessageTypeEnum", - "format": "" - }, - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "direction", - "baseName": "direction", - "type": "ChatMessageDirectionEnum", - "format": "" - }, - { - "name": "sentAt", - "baseName": "sentAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "manualCreator", - "baseName": "manualCreator", - "type": "PersonData", - "format": "" - }, - { - "name": "participants", - "baseName": "participants", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ChatMessage.attributeTypeMap; - } - - public constructor() { - } -} - -export enum ChatMessageTypeEnum { - ChatMessage = 'chat-message' -} -export enum ChatMessageDirectionEnum { - Received = 'received', - Sent = 'sent' -} - diff --git a/src/v2/generated/models/CompaniesValue.ts b/src/v2/generated/models/CompaniesValue.ts deleted file mode 100644 index 3bb94f7..0000000 --- a/src/v2/generated/models/CompaniesValue.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { CompanyData } from '../models/CompanyData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class CompaniesValue { - /** - * The type of value - */ - 'type': CompaniesValueTypeEnum; - /** - * The values for many companies - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "CompaniesValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return CompaniesValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum CompaniesValueTypeEnum { - CompanyMulti = 'company-multi' -} - diff --git a/src/v2/generated/models/Company.ts b/src/v2/generated/models/Company.ts deleted file mode 100644 index 729450b..0000000 --- a/src/v2/generated/models/Company.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Field } from '../models/Field.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* Company model -*/ -export class Company { - /** - * The company\'s unique identifier - */ - 'id': number; - /** - * The company\'s name - */ - 'name': string; - /** - * The company\'s primary domain - */ - 'domain': string; - /** - * All of the company\'s domains - */ - 'domains': Array; - /** - * Whether or not the company is org specific - */ - 'isGlobal': boolean; - /** - * The fields associated with the company - */ - 'fields'?: Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "domain", - "baseName": "domain", - "type": "string", - "format": "hostname" - }, - { - "name": "domains", - "baseName": "domains", - "type": "Array", - "format": "hostname" - }, - { - "name": "isGlobal", - "baseName": "isGlobal", - "type": "boolean", - "format": "" - }, - { - "name": "fields", - "baseName": "fields", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Company.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/CompanyData.ts b/src/v2/generated/models/CompanyData.ts deleted file mode 100644 index 9963028..0000000 --- a/src/v2/generated/models/CompanyData.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class CompanyData { - /** - * The company\'s unique identifier - */ - 'id': number; - /** - * The company\'s name - */ - 'name': string; - /** - * The company\'s primary domain - */ - 'domain': string; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "domain", - "baseName": "domain", - "type": "string", - "format": "hostname" - } ]; - - static getAttributeTypeMap() { - return CompanyData.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/CompanyListEntry.ts b/src/v2/generated/models/CompanyListEntry.ts deleted file mode 100644 index b73ef76..0000000 --- a/src/v2/generated/models/CompanyListEntry.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Company } from '../models/Company.ts'; -import { HttpFile } from '../http/http.ts'; - -export class CompanyListEntry { - /** - * The list entry\'s unique identifier - */ - 'id': number; - /** - * The entity type for this list entry - */ - 'type': CompanyListEntryTypeEnum; - /** - * The date that the list entry was created - */ - 'createdAt': Date; - /** - * The ID of the user that created this list entry - */ - 'creatorId': number | null; - 'entity': Company; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "type", - "baseName": "type", - "type": "CompanyListEntryTypeEnum", - "format": "" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "entity", - "baseName": "entity", - "type": "Company", - "format": "" - } ]; - - static getAttributeTypeMap() { - return CompanyListEntry.attributeTypeMap; - } - - public constructor() { - } -} - -export enum CompanyListEntryTypeEnum { - Company = 'company' -} - diff --git a/src/v2/generated/models/CompanyPaged.ts b/src/v2/generated/models/CompanyPaged.ts deleted file mode 100644 index 53d6640..0000000 --- a/src/v2/generated/models/CompanyPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Company } from '../models/Company.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* CompanyPaged model -*/ -export class CompanyPaged { - /** - * A page of Company results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return CompanyPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/CompanyValue.ts b/src/v2/generated/models/CompanyValue.ts deleted file mode 100644 index da6ae9a..0000000 --- a/src/v2/generated/models/CompanyValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { CompanyData } from '../models/CompanyData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class CompanyValue { - /** - * The type of value - */ - 'type': CompanyValueTypeEnum; - 'data': CompanyData | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "CompanyValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "CompanyData", - "format": "" - } ]; - - static getAttributeTypeMap() { - return CompanyValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum CompanyValueTypeEnum { - Company = 'company' -} - diff --git a/src/v2/generated/models/ConflictError.ts b/src/v2/generated/models/ConflictError.ts deleted file mode 100644 index 2113fe6..0000000 --- a/src/v2/generated/models/ConflictError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class ConflictError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ConflictError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/DateValue.ts b/src/v2/generated/models/DateValue.ts deleted file mode 100644 index b9e6545..0000000 --- a/src/v2/generated/models/DateValue.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class DateValue { - /** - * The type of value - */ - 'type': DateValueTypeEnum; - /** - * The value for a date - */ - 'data': Date | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "DateValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Date", - "format": "date-time" - } ]; - - static getAttributeTypeMap() { - return DateValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum DateValueTypeEnum { - Datetime = 'datetime' -} - diff --git a/src/v2/generated/models/Dropdown.ts b/src/v2/generated/models/Dropdown.ts deleted file mode 100644 index 447983b..0000000 --- a/src/v2/generated/models/Dropdown.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Dropdown { - /** - * Dropdown item\'s unique identifier - */ - 'dropdownOptionId': number; - /** - * Dropdown item text - */ - 'text': string; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "dropdownOptionId", - "baseName": "dropdownOptionId", - "type": "number", - "format": "int64" - }, - { - "name": "text", - "baseName": "text", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Dropdown.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/DropdownValue.ts b/src/v2/generated/models/DropdownValue.ts deleted file mode 100644 index d46cf48..0000000 --- a/src/v2/generated/models/DropdownValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Dropdown } from '../models/Dropdown.ts'; -import { HttpFile } from '../http/http.ts'; - -export class DropdownValue { - /** - * The type of value - */ - 'type': DropdownValueTypeEnum; - 'data': Dropdown | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "DropdownValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Dropdown", - "format": "" - } ]; - - static getAttributeTypeMap() { - return DropdownValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum DropdownValueTypeEnum { - Dropdown = 'dropdown' -} - diff --git a/src/v2/generated/models/DropdownsValue.ts b/src/v2/generated/models/DropdownsValue.ts deleted file mode 100644 index 2430f5e..0000000 --- a/src/v2/generated/models/DropdownsValue.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Dropdown } from '../models/Dropdown.ts'; -import { HttpFile } from '../http/http.ts'; - -export class DropdownsValue { - /** - * The type of value - */ - 'type': DropdownsValueTypeEnum; - /** - * The value for many dropdown items - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "DropdownsValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return DropdownsValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum DropdownsValueTypeEnum { - DropdownMulti = 'dropdown-multi' -} - diff --git a/src/v2/generated/models/Email.ts b/src/v2/generated/models/Email.ts deleted file mode 100644 index bacc6ac..0000000 --- a/src/v2/generated/models/Email.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Attendee } from '../models/Attendee.ts'; -import { HttpFile } from '../http/http.ts'; - -export class Email { - /** - * The type of interaction - */ - 'type': EmailTypeEnum; - /** - * The email\'s unique identifier - */ - 'id': number; - /** - * The subject of the email - */ - 'subject': string | null; - /** - * The time the email was sent - */ - 'sentAt': Date; - '_from': Attendee; - /** - * The recipients of the email - */ - 'to': Array; - /** - * The cc recipients of the email - */ - 'cc': Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "EmailTypeEnum", - "format": "" - }, - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "subject", - "baseName": "subject", - "type": "string", - "format": "" - }, - { - "name": "sentAt", - "baseName": "sentAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "_from", - "baseName": "from", - "type": "Attendee", - "format": "" - }, - { - "name": "to", - "baseName": "to", - "type": "Array", - "format": "" - }, - { - "name": "cc", - "baseName": "cc", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Email.attributeTypeMap; - } - - public constructor() { - } -} - -export enum EmailTypeEnum { - Email = 'email' -} - diff --git a/src/v2/generated/models/EmptyMessageBodyError.ts b/src/v2/generated/models/EmptyMessageBodyError.ts deleted file mode 100644 index f908260..0000000 --- a/src/v2/generated/models/EmptyMessageBodyError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class EmptyMessageBodyError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return EmptyMessageBodyError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Errors.ts b/src/v2/generated/models/Errors.ts deleted file mode 100644 index dd05ff9..0000000 --- a/src/v2/generated/models/Errors.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Errors { - /** - * Errors - */ - 'errors'?: Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "errors", - "baseName": "errors", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Errors.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Field.ts b/src/v2/generated/models/Field.ts deleted file mode 100644 index 616f308..0000000 --- a/src/v2/generated/models/Field.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { FieldValue } from '../models/FieldValue.ts'; -import { HttpFile } from '../http/http.ts'; - -export class Field { - /** - * The field\'s unique identifier - */ - 'id': string; - /** - * The field\'s name - */ - 'name': string; - /** - * The field\'s type - */ - 'type': FieldTypeEnum; - /** - * The source of the data in this Field (if it is enriched) - */ - 'enrichmentSource': FieldEnrichmentSourceEnum | null; - 'value': FieldValue; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "string", - "format": "" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "type", - "baseName": "type", - "type": "FieldTypeEnum", - "format": "" - }, - { - "name": "enrichmentSource", - "baseName": "enrichmentSource", - "type": "FieldEnrichmentSourceEnum", - "format": "" - }, - { - "name": "value", - "baseName": "value", - "type": "FieldValue", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Field.attributeTypeMap; - } - - public constructor() { - } -} - -export enum FieldTypeEnum { - Enriched = 'enriched', - Global = 'global', - List = 'list', - RelationshipIntelligence = 'relationship-intelligence' -} -export enum FieldEnrichmentSourceEnum { - AffinityData = 'affinity-data', - Dealroom = 'dealroom' -} - diff --git a/src/v2/generated/models/FieldMetadata.ts b/src/v2/generated/models/FieldMetadata.ts deleted file mode 100644 index 5b14f0d..0000000 --- a/src/v2/generated/models/FieldMetadata.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class FieldMetadata { - /** - * The field\'s unique identifier - */ - 'id': string; - /** - * The field\'s name - */ - 'name': string; - /** - * The field\'s type - */ - 'type': FieldMetadataTypeEnum; - /** - * The source of the data in this Field (if it is enriched) - */ - 'enrichmentSource': FieldMetadataEnrichmentSourceEnum | null; - /** - * The type of the data in this Field - */ - 'valueType': FieldMetadataValueTypeEnum; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "string", - "format": "" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "type", - "baseName": "type", - "type": "FieldMetadataTypeEnum", - "format": "" - }, - { - "name": "enrichmentSource", - "baseName": "enrichmentSource", - "type": "FieldMetadataEnrichmentSourceEnum", - "format": "" - }, - { - "name": "valueType", - "baseName": "valueType", - "type": "FieldMetadataValueTypeEnum", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FieldMetadata.attributeTypeMap; - } - - public constructor() { - } -} - -export enum FieldMetadataTypeEnum { - Enriched = 'enriched', - Global = 'global', - List = 'list', - RelationshipIntelligence = 'relationship-intelligence' -} -export enum FieldMetadataEnrichmentSourceEnum { - AffinityData = 'affinity-data', - Dealroom = 'dealroom' -} -export enum FieldMetadataValueTypeEnum { - Person = 'person', - PersonMulti = 'person-multi', - Company = 'company', - CompanyMulti = 'company-multi', - FilterableText = 'filterable-text', - FilterableTextMulti = 'filterable-text-multi', - Number = 'number', - NumberMulti = 'number-multi', - Datetime = 'datetime', - Location = 'location', - LocationMulti = 'location-multi', - Text = 'text', - RankedDropdown = 'ranked-dropdown', - Dropdown = 'dropdown', - DropdownMulti = 'dropdown-multi', - FormulaNumber = 'formula-number', - Interaction = 'interaction' -} - diff --git a/src/v2/generated/models/FieldMetadataPaged.ts b/src/v2/generated/models/FieldMetadataPaged.ts deleted file mode 100644 index 267ae31..0000000 --- a/src/v2/generated/models/FieldMetadataPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { FieldMetadata } from '../models/FieldMetadata.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* FieldMetadataPaged model -*/ -export class FieldMetadataPaged { - /** - * A page of FieldMetadata results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FieldMetadataPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/FieldValue.ts b/src/v2/generated/models/FieldValue.ts deleted file mode 100644 index 3a3a9ca..0000000 --- a/src/v2/generated/models/FieldValue.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { CompaniesValue } from '../models/CompaniesValue.ts'; -import { CompanyValue } from '../models/CompanyValue.ts'; -import { DateValue } from '../models/DateValue.ts'; -import { DropdownValue } from '../models/DropdownValue.ts'; -import { DropdownsValue } from '../models/DropdownsValue.ts'; -import { FloatValue } from '../models/FloatValue.ts'; -import { FloatsValue } from '../models/FloatsValue.ts'; -import { FormulaValue } from '../models/FormulaValue.ts'; -import { InteractionValue } from '../models/InteractionValue.ts'; -import { LocationValue } from '../models/LocationValue.ts'; -import { LocationsValue } from '../models/LocationsValue.ts'; -import { PersonValue } from '../models/PersonValue.ts'; -import { PersonsValue } from '../models/PersonsValue.ts'; -import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; -import { TextValue } from '../models/TextValue.ts'; -import { TextsValue } from '../models/TextsValue.ts'; -import { HttpFile } from '../http/http.ts'; - -/** - * @type FieldValue - * Type - * @export - */ -export type FieldValue = CompaniesValue | CompanyValue | DateValue | DropdownValue | DropdownsValue | FloatValue | FloatsValue | FormulaValue | InteractionValue | LocationValue | LocationsValue | PersonValue | PersonsValue | RankedDropdownValue | TextValue | TextsValue; - -/** -* @type FieldValueClass -* @export -*/ -export class FieldValueClass { - static readonly discriminator: string | undefined = "type"; - - static readonly mapping: {[index: string]: string} | undefined = { - "company": "CompanyValue", - "company-multi": "CompaniesValue", - "datetime": "DateValue", - "dropdown": "DropdownValue", - "dropdown-multi": "DropdownsValue", - "filterable-text": "TextValue", - "filterable-text-multi": "TextsValue", - "formula-number": "FormulaValue", - "interaction": "InteractionValue", - "location": "LocationValue", - "location-multi": "LocationsValue", - "number": "FloatValue", - "number-multi": "FloatsValue", - "person": "PersonValue", - "person-multi": "PersonsValue", - "ranked-dropdown": "RankedDropdownValue", - "text": "TextValue", - }; -} - - - - - - - - - - - - - - - diff --git a/src/v2/generated/models/FloatValue.ts b/src/v2/generated/models/FloatValue.ts deleted file mode 100644 index d3be36e..0000000 --- a/src/v2/generated/models/FloatValue.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class FloatValue { - /** - * The type of value - */ - 'type': FloatValueTypeEnum; - /** - * The value for a number - */ - 'data': number | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "FloatValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "number", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FloatValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum FloatValueTypeEnum { - Number = 'number' -} - diff --git a/src/v2/generated/models/FloatsValue.ts b/src/v2/generated/models/FloatsValue.ts deleted file mode 100644 index 8c2d9c7..0000000 --- a/src/v2/generated/models/FloatsValue.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class FloatsValue { - /** - * The type of value - */ - 'type': FloatsValueTypeEnum; - /** - * The value for many numbers - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "FloatsValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FloatsValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum FloatsValueTypeEnum { - NumberMulti = 'number-multi' -} - diff --git a/src/v2/generated/models/FormulaNumber.ts b/src/v2/generated/models/FormulaNumber.ts deleted file mode 100644 index 02730b0..0000000 --- a/src/v2/generated/models/FormulaNumber.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class FormulaNumber { - /** - * Calculated value - */ - 'calculatedValue'?: number | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "calculatedValue", - "baseName": "calculatedValue", - "type": "number", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FormulaNumber.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/FormulaValue.ts b/src/v2/generated/models/FormulaValue.ts deleted file mode 100644 index 02a114b..0000000 --- a/src/v2/generated/models/FormulaValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { FormulaNumber } from '../models/FormulaNumber.ts'; -import { HttpFile } from '../http/http.ts'; - -export class FormulaValue { - /** - * The type of value - */ - 'type': FormulaValueTypeEnum; - 'data': FormulaNumber | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "FormulaValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "FormulaNumber", - "format": "" - } ]; - - static getAttributeTypeMap() { - return FormulaValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum FormulaValueTypeEnum { - FormulaNumber = 'formula-number' -} - diff --git a/src/v2/generated/models/GenericError.ts b/src/v2/generated/models/GenericError.ts deleted file mode 100644 index a97a70a..0000000 --- a/src/v2/generated/models/GenericError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class GenericError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return GenericError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Grant.ts b/src/v2/generated/models/Grant.ts deleted file mode 100644 index 2287cf5..0000000 --- a/src/v2/generated/models/Grant.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Grant { - /** - * The type of grant used to authenticate - */ - 'type': GrantTypeEnum; - /** - * The scopes available to the current grant - */ - 'scopes': Array; - /** - * When the grant was created - */ - 'createdAt': Date; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "GrantTypeEnum", - "format": "" - }, - { - "name": "scopes", - "baseName": "scopes", - "type": "Array", - "format": "" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - } ]; - - static getAttributeTypeMap() { - return Grant.attributeTypeMap; - } - - public constructor() { - } -} - -export enum GrantTypeEnum { - ApiKey = 'api-key' -} - diff --git a/src/v2/generated/models/Interaction.ts b/src/v2/generated/models/Interaction.ts deleted file mode 100644 index c811b26..0000000 --- a/src/v2/generated/models/Interaction.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ChatMessage } from '../models/ChatMessage.ts'; -import { Email } from '../models/Email.ts'; -import { Meeting } from '../models/Meeting.ts'; -import { PhoneCall } from '../models/PhoneCall.ts'; -import { HttpFile } from '../http/http.ts'; - -/** - * @type Interaction - * Type - * @export - */ -export type Interaction = ChatMessage | Email | Meeting | PhoneCall; - -/** -* @type InteractionClass -* @export -*/ -export class InteractionClass { - static readonly discriminator: string | undefined = "type"; - - static readonly mapping: {[index: string]: string} | undefined = { - "call": "PhoneCall", - "chat-message": "ChatMessage", - "email": "Email", - "meeting": "Meeting", - }; -} - - - diff --git a/src/v2/generated/models/InteractionValue.ts b/src/v2/generated/models/InteractionValue.ts deleted file mode 100644 index 80a5cda..0000000 --- a/src/v2/generated/models/InteractionValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Interaction } from '../models/Interaction.ts'; -import { HttpFile } from '../http/http.ts'; - -export class InteractionValue { - /** - * The type of value - */ - 'type': InteractionValueTypeEnum; - 'data': Interaction | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "InteractionValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Interaction", - "format": "" - } ]; - - static getAttributeTypeMap() { - return InteractionValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum InteractionValueTypeEnum { - Interaction = 'interaction' -} - diff --git a/src/v2/generated/models/InvalidAcceptHeaderError.ts b/src/v2/generated/models/InvalidAcceptHeaderError.ts deleted file mode 100644 index 508dde2..0000000 --- a/src/v2/generated/models/InvalidAcceptHeaderError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class InvalidAcceptHeaderError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return InvalidAcceptHeaderError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/InvalidMessageBodyError.ts b/src/v2/generated/models/InvalidMessageBodyError.ts deleted file mode 100644 index c4337a2..0000000 --- a/src/v2/generated/models/InvalidMessageBodyError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class InvalidMessageBodyError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return InvalidMessageBodyError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/InvalidVersionHeaderError.ts b/src/v2/generated/models/InvalidVersionHeaderError.ts deleted file mode 100644 index c0ba9d4..0000000 --- a/src/v2/generated/models/InvalidVersionHeaderError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class InvalidVersionHeaderError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return InvalidVersionHeaderError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/List.ts b/src/v2/generated/models/List.ts deleted file mode 100644 index 6cf2460..0000000 --- a/src/v2/generated/models/List.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class List { - /** - * The unique identifier for the list - */ - 'id': number; - /** - * The name of the list - */ - 'name': string; - /** - * The ID of the user that created this list - */ - 'creatorId': number; - /** - * The ID of the user that owns this list - */ - 'ownerId': number; - /** - * Whether or not the list is public - */ - 'isPublic': boolean; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "ownerId", - "baseName": "ownerId", - "type": "number", - "format": "int64" - }, - { - "name": "isPublic", - "baseName": "isPublic", - "type": "boolean", - "format": "" - } ]; - - static getAttributeTypeMap() { - return List.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ListEntry.ts b/src/v2/generated/models/ListEntry.ts deleted file mode 100644 index 188de9f..0000000 --- a/src/v2/generated/models/ListEntry.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Field } from '../models/Field.ts'; -import { HttpFile } from '../http/http.ts'; - -export class ListEntry { - /** - * The list entry\'s unique identifier - */ - 'id': number; - /** - * The ID of the list that this list entry belongs to - */ - 'listId': number; - /** - * The date that the list entry was created - */ - 'createdAt': Date; - /** - * The ID of the user that created this list entry - */ - 'creatorId': number | null; - /** - * The fields associated with the list entry - */ - 'fields': Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "listId", - "baseName": "listId", - "type": "number", - "format": "int64" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "fields", - "baseName": "fields", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListEntry.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ListEntryPaged.ts b/src/v2/generated/models/ListEntryPaged.ts deleted file mode 100644 index 8c5aa84..0000000 --- a/src/v2/generated/models/ListEntryPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ListEntry } from '../models/ListEntry.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* ListEntryPaged model -*/ -export class ListEntryPaged { - /** - * A page of ListEntry results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListEntryPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ListEntryWithEntity.ts b/src/v2/generated/models/ListEntryWithEntity.ts deleted file mode 100644 index ab86530..0000000 --- a/src/v2/generated/models/ListEntryWithEntity.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { CompanyListEntry } from '../models/CompanyListEntry.ts'; -import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; -import { PersonListEntry } from '../models/PersonListEntry.ts'; -import { HttpFile } from '../http/http.ts'; - -/** - * @type ListEntryWithEntity - * Type - * @export - */ -export type ListEntryWithEntity = CompanyListEntry | OpportunityListEntry | PersonListEntry; - -/** -* @type ListEntryWithEntityClass -* @export -*/ -export class ListEntryWithEntityClass { - static readonly discriminator: string | undefined = "type"; - - static readonly mapping: {[index: string]: string} | undefined = { - "company": "CompanyListEntry", - "opportunity": "OpportunityListEntry", - "person": "PersonListEntry", - }; -} - - diff --git a/src/v2/generated/models/ListEntryWithEntityPaged.ts b/src/v2/generated/models/ListEntryWithEntityPaged.ts deleted file mode 100644 index 047d58c..0000000 --- a/src/v2/generated/models/ListEntryWithEntityPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* ListEntryWithEntityPaged model -*/ -export class ListEntryWithEntityPaged { - /** - * A page of ListEntryWithEntity results - */ - 'data': Array | null; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListEntryWithEntityPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ListPaged.ts b/src/v2/generated/models/ListPaged.ts deleted file mode 100644 index 28e21cb..0000000 --- a/src/v2/generated/models/ListPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { List } from '../models/List.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* ListPaged model -*/ -export class ListPaged { - /** - * A page of List results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ListWithType.ts b/src/v2/generated/models/ListWithType.ts deleted file mode 100644 index 9a0b1ac..0000000 --- a/src/v2/generated/models/ListWithType.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -/** -* ListWithType model -*/ -export class ListWithType { - /** - * The unique identifier for the list - */ - 'id': number; - /** - * The name of the list - */ - 'name': string; - /** - * The ID of the user that created this list - */ - 'creatorId': number; - /** - * The ID of the user that owns this list - */ - 'ownerId': number; - /** - * Whether or not the list is public - */ - 'isPublic': boolean; - /** - * The entity type for this list - */ - 'type': ListWithTypeTypeEnum; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "ownerId", - "baseName": "ownerId", - "type": "number", - "format": "int64" - }, - { - "name": "isPublic", - "baseName": "isPublic", - "type": "boolean", - "format": "" - }, - { - "name": "type", - "baseName": "type", - "type": "ListWithTypeTypeEnum", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListWithType.attributeTypeMap; - } - - public constructor() { - } -} - -export enum ListWithTypeTypeEnum { - Company = 'company', - Opportunity = 'opportunity', - Person = 'person' -} - diff --git a/src/v2/generated/models/ListWithTypePaged.ts b/src/v2/generated/models/ListWithTypePaged.ts deleted file mode 100644 index 25d917a..0000000 --- a/src/v2/generated/models/ListWithTypePaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ListWithType } from '../models/ListWithType.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* ListWithTypePaged model -*/ -export class ListWithTypePaged { - /** - * A page of ListWithType results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ListWithTypePaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Location.ts b/src/v2/generated/models/Location.ts deleted file mode 100644 index 8a33a3d..0000000 --- a/src/v2/generated/models/Location.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Location { - /** - * Street address - */ - 'streetAddress': string | null; - /** - * City - */ - 'city': string | null; - /** - * State - */ - 'state': string | null; - /** - * Country - */ - 'country': string | null; - /** - * Continent - */ - 'continent': string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "streetAddress", - "baseName": "streetAddress", - "type": "string", - "format": "" - }, - { - "name": "city", - "baseName": "city", - "type": "string", - "format": "" - }, - { - "name": "state", - "baseName": "state", - "type": "string", - "format": "" - }, - { - "name": "country", - "baseName": "country", - "type": "string", - "format": "" - }, - { - "name": "continent", - "baseName": "continent", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Location.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/LocationValue.ts b/src/v2/generated/models/LocationValue.ts deleted file mode 100644 index 1b2276c..0000000 --- a/src/v2/generated/models/LocationValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Location } from '../models/Location.ts'; -import { HttpFile } from '../http/http.ts'; - -export class LocationValue { - /** - * The type of value - */ - 'type': LocationValueTypeEnum; - 'data': Location | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "LocationValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Location", - "format": "" - } ]; - - static getAttributeTypeMap() { - return LocationValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum LocationValueTypeEnum { - Location = 'location' -} - diff --git a/src/v2/generated/models/LocationsValue.ts b/src/v2/generated/models/LocationsValue.ts deleted file mode 100644 index b1f9515..0000000 --- a/src/v2/generated/models/LocationsValue.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Location } from '../models/Location.ts'; -import { HttpFile } from '../http/http.ts'; - -export class LocationsValue { - /** - * The type of value - */ - 'type': LocationsValueTypeEnum; - /** - * The values for many locations - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "LocationsValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return LocationsValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum LocationsValueTypeEnum { - LocationMulti = 'location-multi' -} - diff --git a/src/v2/generated/models/Meeting.ts b/src/v2/generated/models/Meeting.ts deleted file mode 100644 index 5359c8a..0000000 --- a/src/v2/generated/models/Meeting.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Attendee } from '../models/Attendee.ts'; -import { HttpFile } from '../http/http.ts'; - -export class Meeting { - /** - * The type of interaction - */ - 'type': MeetingTypeEnum; - /** - * The meeting\'s unique identifier - */ - 'id': number; - /** - * The meeting\'s title - */ - 'title': string | null; - /** - * Whether the meeting is an all-day event - */ - 'allDay': boolean; - /** - * The meeting start time - */ - 'startTime': Date; - /** - * The meeting end time - */ - 'endTime': Date | null; - /** - * People attending the meeting - */ - 'attendees': Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "MeetingTypeEnum", - "format": "" - }, - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "title", - "baseName": "title", - "type": "string", - "format": "" - }, - { - "name": "allDay", - "baseName": "allDay", - "type": "boolean", - "format": "" - }, - { - "name": "startTime", - "baseName": "startTime", - "type": "Date", - "format": "date-time" - }, - { - "name": "endTime", - "baseName": "endTime", - "type": "Date", - "format": "date-time" - }, - { - "name": "attendees", - "baseName": "attendees", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Meeting.attributeTypeMap; - } - - public constructor() { - } -} - -export enum MeetingTypeEnum { - Meeting = 'meeting' -} - diff --git a/src/v2/generated/models/MethodNotAllowedError.ts b/src/v2/generated/models/MethodNotAllowedError.ts deleted file mode 100644 index 4dd3592..0000000 --- a/src/v2/generated/models/MethodNotAllowedError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class MethodNotAllowedError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return MethodNotAllowedError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ModelError.ts b/src/v2/generated/models/ModelError.ts deleted file mode 100644 index 592803c..0000000 --- a/src/v2/generated/models/ModelError.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { ConflictError } from '../models/ConflictError.ts'; -import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; -import { GenericError } from '../models/GenericError.ts'; -import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; -import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; -import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; -import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; -import { NotFoundError } from '../models/NotFoundError.ts'; -import { RateLimitError } from '../models/RateLimitError.ts'; -import { ServerError } from '../models/ServerError.ts'; -import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; -import { ValidationError } from '../models/ValidationError.ts'; -import { HttpFile } from '../http/http.ts'; - -/** - * @type ModelError - * Type - * @export - */ -export type ModelError = AuthenticationError | AuthorizationError | ConflictError | EmptyMessageBodyError | GenericError | InvalidAcceptHeaderError | InvalidMessageBodyError | InvalidVersionHeaderError | MethodNotAllowedError | NotFoundError | RateLimitError | ServerError | TooManyMultipartFilesError | ValidationError; - -/** -* @type ModelErrorClass -* @export -*/ -export class ModelErrorClass { - static readonly discriminator: string | undefined = "code"; - - static readonly mapping: {[index: string]: string} | undefined = { - "authentication": "AuthenticationError", - "authorization": "AuthorizationError", - "conflict": "ConflictError", - "empty-message-body": "EmptyMessageBodyError", - "error": "GenericError", - "invalid-accept-header": "InvalidAcceptHeaderError", - "invalid-message-body": "InvalidMessageBodyError", - "invalid-version-header": "InvalidVersionHeaderError", - "method-not-allowed": "MethodNotAllowedError", - "not-found": "NotFoundError", - "rate-limit": "RateLimitError", - "server": "ServerError", - "too-many-multipart-files": "TooManyMultipartFilesError", - "validation": "ValidationError", - }; -} - - - - - - - - - - - - - diff --git a/src/v2/generated/models/NotFoundError.ts b/src/v2/generated/models/NotFoundError.ts deleted file mode 100644 index 25c81ef..0000000 --- a/src/v2/generated/models/NotFoundError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class NotFoundError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return NotFoundError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/NotFoundErrors.ts b/src/v2/generated/models/NotFoundErrors.ts deleted file mode 100644 index 3b995191..0000000 --- a/src/v2/generated/models/NotFoundErrors.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { NotFoundError } from '../models/NotFoundError.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* NotFoundErrors model -*/ -export class NotFoundErrors { - /** - * NotFoundError errors - */ - 'errors'?: Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "errors", - "baseName": "errors", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return NotFoundErrors.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ObjectSerializer.ts b/src/v2/generated/models/ObjectSerializer.ts deleted file mode 100644 index a7d9e8a..0000000 --- a/src/v2/generated/models/ObjectSerializer.ts +++ /dev/null @@ -1,574 +0,0 @@ -export * from '../models/Attendee.ts'; -export * from '../models/AuthenticationError.ts'; -export * from '../models/AuthenticationErrors.ts'; -export * from '../models/AuthorizationError.ts'; -export * from '../models/AuthorizationErrors.ts'; -export * from '../models/ChatMessage.ts'; -export * from '../models/CompaniesValue.ts'; -export * from '../models/Company.ts'; -export * from '../models/CompanyData.ts'; -export * from '../models/CompanyListEntry.ts'; -export * from '../models/CompanyPaged.ts'; -export * from '../models/CompanyValue.ts'; -export * from '../models/ConflictError.ts'; -export * from '../models/DateValue.ts'; -export * from '../models/Dropdown.ts'; -export * from '../models/DropdownValue.ts'; -export * from '../models/DropdownsValue.ts'; -export * from '../models/Email.ts'; -export * from '../models/EmptyMessageBodyError.ts'; -export * from '../models/Errors.ts'; -export * from '../models/Field.ts'; -export * from '../models/FieldMetadata.ts'; -export * from '../models/FieldMetadataPaged.ts'; -export * from '../models/FieldValue.ts'; -export * from '../models/FloatValue.ts'; -export * from '../models/FloatsValue.ts'; -export * from '../models/FormulaNumber.ts'; -export * from '../models/FormulaValue.ts'; -export * from '../models/GenericError.ts'; -export * from '../models/Grant.ts'; -export * from '../models/Interaction.ts'; -export * from '../models/InteractionValue.ts'; -export * from '../models/InvalidAcceptHeaderError.ts'; -export * from '../models/InvalidMessageBodyError.ts'; -export * from '../models/InvalidVersionHeaderError.ts'; -export * from '../models/List.ts'; -export * from '../models/ListEntry.ts'; -export * from '../models/ListEntryPaged.ts'; -export * from '../models/ListEntryWithEntity.ts'; -export * from '../models/ListEntryWithEntityPaged.ts'; -export * from '../models/ListPaged.ts'; -export * from '../models/ListWithType.ts'; -export * from '../models/ListWithTypePaged.ts'; -export * from '../models/Location.ts'; -export * from '../models/LocationValue.ts'; -export * from '../models/LocationsValue.ts'; -export * from '../models/Meeting.ts'; -export * from '../models/MethodNotAllowedError.ts'; -export * from '../models/ModelError.ts'; -export * from '../models/NotFoundError.ts'; -export * from '../models/NotFoundErrors.ts'; -export * from '../models/Opportunity.ts'; -export * from '../models/OpportunityListEntry.ts'; -export * from '../models/OpportunityPaged.ts'; -export * from '../models/OpportunityWithFields.ts'; -export * from '../models/Pagination.ts'; -export * from '../models/Person.ts'; -export * from '../models/PersonData.ts'; -export * from '../models/PersonListEntry.ts'; -export * from '../models/PersonPaged.ts'; -export * from '../models/PersonValue.ts'; -export * from '../models/PersonsValue.ts'; -export * from '../models/PhoneCall.ts'; -export * from '../models/RankedDropdown.ts'; -export * from '../models/RankedDropdownValue.ts'; -export * from '../models/RateLimitError.ts'; -export * from '../models/SavedView.ts'; -export * from '../models/SavedViewPaged.ts'; -export * from '../models/ServerError.ts'; -export * from '../models/Tenant.ts'; -export * from '../models/TextValue.ts'; -export * from '../models/TextsValue.ts'; -export * from '../models/TooManyMultipartFilesError.ts'; -export * from '../models/User.ts'; -export * from '../models/ValidationError.ts'; -export * from '../models/ValidationErrors.ts'; -export * from '../models/WhoAmI.ts'; - -import { Attendee } from '../models/Attendee.ts'; -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { ChatMessage, ChatMessageTypeEnum , ChatMessageDirectionEnum } from '../models/ChatMessage.ts'; -import { CompaniesValue, CompaniesValueTypeEnum } from '../models/CompaniesValue.ts'; -import { Company } from '../models/Company.ts'; -import { CompanyData } from '../models/CompanyData.ts'; -import { CompanyListEntry , CompanyListEntryTypeEnum } from '../models/CompanyListEntry.ts'; -import { CompanyPaged } from '../models/CompanyPaged.ts'; -import { CompanyValue, CompanyValueTypeEnum } from '../models/CompanyValue.ts'; -import { ConflictError } from '../models/ConflictError.ts'; -import { DateValue, DateValueTypeEnum } from '../models/DateValue.ts'; -import { Dropdown } from '../models/Dropdown.ts'; -import { DropdownValue, DropdownValueTypeEnum } from '../models/DropdownValue.ts'; -import { DropdownsValue, DropdownsValueTypeEnum } from '../models/DropdownsValue.ts'; -import { Email, EmailTypeEnum } from '../models/Email.ts'; -import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; -import { Errors } from '../models/Errors.ts'; -import { Field , FieldTypeEnum , FieldEnrichmentSourceEnum } from '../models/Field.ts'; -import { FieldMetadata , FieldMetadataTypeEnum , FieldMetadataEnrichmentSourceEnum , FieldMetadataValueTypeEnum } from '../models/FieldMetadata.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { FieldValueClass } from '../models/FieldValue.ts'; -import { FloatValue, FloatValueTypeEnum } from '../models/FloatValue.ts'; -import { FloatsValue, FloatsValueTypeEnum } from '../models/FloatsValue.ts'; -import { FormulaNumber } from '../models/FormulaNumber.ts'; -import { FormulaValue, FormulaValueTypeEnum } from '../models/FormulaValue.ts'; -import { GenericError } from '../models/GenericError.ts'; -import { Grant, GrantTypeEnum } from '../models/Grant.ts'; -import { InteractionClass } from '../models/Interaction.ts'; -import { InteractionValue, InteractionValueTypeEnum } from '../models/InteractionValue.ts'; -import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; -import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; -import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; -import { List } from '../models/List.ts'; -import { ListEntry } from '../models/ListEntry.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListEntryWithEntityClass } from '../models/ListEntryWithEntity.ts'; -import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { ListWithType , ListWithTypeTypeEnum } from '../models/ListWithType.ts'; -import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; -import { Location } from '../models/Location.ts'; -import { LocationValue, LocationValueTypeEnum } from '../models/LocationValue.ts'; -import { LocationsValue, LocationsValueTypeEnum } from '../models/LocationsValue.ts'; -import { Meeting, MeetingTypeEnum } from '../models/Meeting.ts'; -import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; -import { ModelErrorClass } from '../models/ModelError.ts'; -import { NotFoundError } from '../models/NotFoundError.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Opportunity } from '../models/Opportunity.ts'; -import { OpportunityListEntry , OpportunityListEntryTypeEnum } from '../models/OpportunityListEntry.ts'; -import { OpportunityPaged } from '../models/OpportunityPaged.ts'; -import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { Person , PersonTypeEnum } from '../models/Person.ts'; -import { PersonData , PersonDataTypeEnum } from '../models/PersonData.ts'; -import { PersonListEntry , PersonListEntryTypeEnum } from '../models/PersonListEntry.ts'; -import { PersonPaged } from '../models/PersonPaged.ts'; -import { PersonValue, PersonValueTypeEnum } from '../models/PersonValue.ts'; -import { PersonsValue, PersonsValueTypeEnum } from '../models/PersonsValue.ts'; -import { PhoneCall, PhoneCallTypeEnum } from '../models/PhoneCall.ts'; -import { RankedDropdown } from '../models/RankedDropdown.ts'; -import { RankedDropdownValue, RankedDropdownValueTypeEnum } from '../models/RankedDropdownValue.ts'; -import { RateLimitError } from '../models/RateLimitError.ts'; -import { SavedView , SavedViewTypeEnum } from '../models/SavedView.ts'; -import { SavedViewPaged } from '../models/SavedViewPaged.ts'; -import { ServerError } from '../models/ServerError.ts'; -import { Tenant } from '../models/Tenant.ts'; -import { TextValue, TextValueTypeEnum } from '../models/TextValue.ts'; -import { TextsValue, TextsValueTypeEnum } from '../models/TextsValue.ts'; -import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; -import { User } from '../models/User.ts'; -import { ValidationError } from '../models/ValidationError.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; -import { WhoAmI } from '../models/WhoAmI.ts'; - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -let enumsMap: Set = new Set([ - "ChatMessageTypeEnum", - "ChatMessageDirectionEnum", - "CompaniesValueTypeEnum", - "CompanyListEntryTypeEnum", - "CompanyValueTypeEnum", - "DateValueTypeEnum", - "DropdownValueTypeEnum", - "DropdownsValueTypeEnum", - "EmailTypeEnum", - "FieldTypeEnum", - "FieldEnrichmentSourceEnum", - "FieldMetadataTypeEnum", - "FieldMetadataEnrichmentSourceEnum", - "FieldMetadataValueTypeEnum", - "FieldValueTypeEnum", - "FloatValueTypeEnum", - "FloatsValueTypeEnum", - "FormulaValueTypeEnum", - "GrantTypeEnum", - "InteractionTypeEnum", - "InteractionDirectionEnum", - "InteractionValueTypeEnum", - "ListEntryWithEntityTypeEnum", - "ListWithTypeTypeEnum", - "LocationValueTypeEnum", - "LocationsValueTypeEnum", - "MeetingTypeEnum", - "OpportunityListEntryTypeEnum", - "PersonTypeEnum", - "PersonDataTypeEnum", - "PersonListEntryTypeEnum", - "PersonValueTypeEnum", - "PersonsValueTypeEnum", - "PhoneCallTypeEnum", - "RankedDropdownValueTypeEnum", - "SavedViewTypeEnum", - "TextValueTypeEnum", - "TextsValueTypeEnum", -]); - -let typeMap: {[index: string]: any} = { - "Attendee": Attendee, - "AuthenticationError": AuthenticationError, - "AuthenticationErrors": AuthenticationErrors, - "AuthorizationError": AuthorizationError, - "AuthorizationErrors": AuthorizationErrors, - "ChatMessage": ChatMessage, - "CompaniesValue": CompaniesValue, - "Company": Company, - "CompanyData": CompanyData, - "CompanyListEntry": CompanyListEntry, - "CompanyPaged": CompanyPaged, - "CompanyValue": CompanyValue, - "ConflictError": ConflictError, - "DateValue": DateValue, - "Dropdown": Dropdown, - "DropdownValue": DropdownValue, - "DropdownsValue": DropdownsValue, - "Email": Email, - "EmptyMessageBodyError": EmptyMessageBodyError, - "Errors": Errors, - "Field": Field, - "FieldMetadata": FieldMetadata, - "FieldMetadataPaged": FieldMetadataPaged, - "FieldValue": FieldValueClass, - "FloatValue": FloatValue, - "FloatsValue": FloatsValue, - "FormulaNumber": FormulaNumber, - "FormulaValue": FormulaValue, - "GenericError": GenericError, - "Grant": Grant, - "Interaction": InteractionClass, - "InteractionValue": InteractionValue, - "InvalidAcceptHeaderError": InvalidAcceptHeaderError, - "InvalidMessageBodyError": InvalidMessageBodyError, - "InvalidVersionHeaderError": InvalidVersionHeaderError, - "List": List, - "ListEntry": ListEntry, - "ListEntryPaged": ListEntryPaged, - "ListEntryWithEntity": ListEntryWithEntityClass, - "ListEntryWithEntityPaged": ListEntryWithEntityPaged, - "ListPaged": ListPaged, - "ListWithType": ListWithType, - "ListWithTypePaged": ListWithTypePaged, - "Location": Location, - "LocationValue": LocationValue, - "LocationsValue": LocationsValue, - "Meeting": Meeting, - "MethodNotAllowedError": MethodNotAllowedError, - "ModelError": ModelErrorClass, - "NotFoundError": NotFoundError, - "NotFoundErrors": NotFoundErrors, - "Opportunity": Opportunity, - "OpportunityListEntry": OpportunityListEntry, - "OpportunityPaged": OpportunityPaged, - "OpportunityWithFields": OpportunityWithFields, - "Pagination": Pagination, - "Person": Person, - "PersonData": PersonData, - "PersonListEntry": PersonListEntry, - "PersonPaged": PersonPaged, - "PersonValue": PersonValue, - "PersonsValue": PersonsValue, - "PhoneCall": PhoneCall, - "RankedDropdown": RankedDropdown, - "RankedDropdownValue": RankedDropdownValue, - "RateLimitError": RateLimitError, - "SavedView": SavedView, - "SavedViewPaged": SavedViewPaged, - "ServerError": ServerError, - "Tenant": Tenant, - "TextValue": TextValue, - "TextsValue": TextsValue, - "TooManyMultipartFilesError": TooManyMultipartFilesError, - "User": User, - "ValidationError": ValidationError, - "ValidationErrors": ValidationErrors, - "WhoAmI": WhoAmI, -} - -type MimeTypeDescriptor = { - type: string; - subtype: string; - subtypeTokens: string[]; -}; - -/** - * Every mime-type consists of a type, subtype, and optional parameters. - * The subtype can be composite, including information about the content format. - * For example: `application/json-patch+json`, `application/merge-patch+json`. - * - * This helper transforms a string mime-type into an internal representation. - * This simplifies the implementation of predicates that in turn define common rules for parsing or stringifying - * the payload. - */ -const parseMimeType = (mimeType: string): MimeTypeDescriptor => { - const [type, subtype] = mimeType.split('/'); - return { - type, - subtype, - subtypeTokens: subtype.split('+'), - }; -}; - -type MimeTypePredicate = (mimeType: string) => boolean; - -// This factory creates a predicate function that checks a string mime-type against defined rules. -const mimeTypePredicateFactory = (predicate: (descriptor: MimeTypeDescriptor) => boolean): MimeTypePredicate => (mimeType) => predicate(parseMimeType(mimeType)); - -// Use this factory when you need to define a simple predicate based only on type and, if applicable, subtype. -const mimeTypeSimplePredicateFactory = (type: string, subtype?: string): MimeTypePredicate => mimeTypePredicateFactory((descriptor) => { - if (descriptor.type !== type) return false; - if (subtype != null && descriptor.subtype !== subtype) return false; - return true; -}); - -// Creating a set of named predicates that will help us determine how to handle different mime-types -const isTextLikeMimeType = mimeTypeSimplePredicateFactory('text'); -const isJsonMimeType = mimeTypeSimplePredicateFactory('application', 'json'); -const isJsonLikeMimeType = mimeTypePredicateFactory((descriptor) => descriptor.type === 'application' && descriptor.subtypeTokens.some((item) => item === 'json')); -const isOctetStreamMimeType = mimeTypeSimplePredicateFactory('application', 'octet-stream'); -const isFormUrlencodedMimeType = mimeTypeSimplePredicateFactory('application', 'x-www-form-urlencoded'); - -// Defining a list of mime-types in the order of prioritization for handling. -const supportedMimeTypePredicatesWithPriority: MimeTypePredicate[] = [ - isJsonMimeType, - isJsonLikeMimeType, - isTextLikeMimeType, - isOctetStreamMimeType, - isFormUrlencodedMimeType, -]; - -const nullableSuffix = " | null"; -const optionalSuffix = " | undefined"; -const arrayPrefix = "Array<"; -const arraySuffix = ">"; -const mapPrefix = "{ [key: string]: "; -const mapSuffix = "; }"; - -export class ObjectSerializer { - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap.has(expectedType)) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; - let mapping = typeMap[expectedType].mapping; - if (mapping != undefined && mapping[discriminatorType]) { - return mapping[discriminatorType]; // use the type given in the discriminator - } else if(typeMap[discriminatorType]) { - return discriminatorType; - } else { - return expectedType; // discriminator did not map to a type - } - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string, format: string): any { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.endsWith(nullableSuffix)) { - let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type - return ObjectSerializer.serialize(data, subType, format); - } else if (type.endsWith(optionalSuffix)) { - let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type - return ObjectSerializer.serialize(data, subType, format); - } else if (type.startsWith(arrayPrefix)) { - let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type - let transformedData: any[] = []; - for (let date of data) { - transformedData.push(ObjectSerializer.serialize(date, subType, format)); - } - return transformedData; - } else if (type.startsWith(mapPrefix)) { - let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type - let transformedData: { [key: string]: any } = {}; - for (let key in data) { - transformedData[key] = ObjectSerializer.serialize( - data[key], - subType, - format, - ); - } - return transformedData; - } else if (type === "Date") { - if (format == "date") { - let month = data.getMonth()+1 - month = month < 10 ? "0" + month.toString() : month.toString() - let day = data.getDate(); - day = day < 10 ? "0" + day.toString() : day.toString(); - - return data.getFullYear() + "-" + month + "-" + day; - } else { - return data.toISOString(); - } - } else { - if (enumsMap.has(type)) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); - } - return instance; - } - } - - public static deserialize(data: any, type: string, format: string): any { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.endsWith(nullableSuffix)) { - let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type - return ObjectSerializer.deserialize(data, subType, format); - } else if (type.endsWith(optionalSuffix)) { - let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type - return ObjectSerializer.deserialize(data, subType, format); - } else if (type.startsWith(arrayPrefix)) { - let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type - let transformedData: any[] = []; - for (let date of data) { - transformedData.push(ObjectSerializer.deserialize(date, subType, format)); - } - return transformedData; - } else if (type.startsWith(mapPrefix)) { - let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type - let transformedData: { [key: string]: any } = {}; - for (let key in data) { - transformedData[key] = ObjectSerializer.deserialize( - data[key], - subType, - format, - ); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap.has(type)) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let attributeType of attributeTypes) { - let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); - if (value !== undefined) { - instance[attributeType.name] = value; - } - } - return instance; - } - } - - - /** - * Normalize media type - * - * We currently do not handle any media types attributes, i.e. anything - * after a semicolon. All content is assumed to be UTF-8 compatible. - */ - public static normalizeMediaType(mediaType: string | undefined): string | undefined { - if (mediaType === undefined) { - return undefined; - } - return mediaType.split(";")[0].trim().toLowerCase(); - } - - /** - * From a list of possible media types, choose the one we can handle best. - * - * The order of the given media types does not have any impact on the choice - * made. - */ - public static getPreferredMediaType(mediaTypes: Array): string { - /** According to OAS 3 we should default to json */ - if (mediaTypes.length === 0) { - return "application/json"; - } - - const normalMediaTypes = mediaTypes.map(this.normalizeMediaType); - - for (const predicate of supportedMimeTypePredicatesWithPriority) { - for (const mediaType of normalMediaTypes) { - if (mediaType != null && predicate(mediaType)) { - return mediaType; - } - } - } - - throw new Error("None of the given media types are supported: " + mediaTypes.join(", ")); - } - - /** - * Convert data to a string according the given media type - */ - public static stringify(data: any, mediaType: string): string { - if (isTextLikeMimeType(mediaType)) { - return String(data); - } - - if (isJsonLikeMimeType(mediaType)) { - return JSON.stringify(data); - } - - throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify."); - } - - /** - * Parse data from a string according to the given media type - */ - public static parse(rawData: string, mediaType: string | undefined) { - if (mediaType === undefined) { - throw new Error("Cannot parse content. No Content-Type defined."); - } - - if (isTextLikeMimeType(mediaType)) { - return rawData; - } - - if (isJsonLikeMimeType(mediaType)) { - return JSON.parse(rawData); - } - - throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse."); - } -} diff --git a/src/v2/generated/models/Opportunity.ts b/src/v2/generated/models/Opportunity.ts deleted file mode 100644 index cad6782..0000000 --- a/src/v2/generated/models/Opportunity.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -/** -* Opportunity model -*/ -export class Opportunity { - /** - * The unique identifier for the opportunity - */ - 'id': number; - /** - * The name of the opportunity - */ - 'name': string; - /** - * The ID of the list that the opportunity belongs to - */ - 'listId': number; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "listId", - "baseName": "listId", - "type": "number", - "format": "int64" - } ]; - - static getAttributeTypeMap() { - return Opportunity.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/OpportunityListEntry.ts b/src/v2/generated/models/OpportunityListEntry.ts deleted file mode 100644 index 14f01d1..0000000 --- a/src/v2/generated/models/OpportunityListEntry.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; -import { HttpFile } from '../http/http.ts'; - -export class OpportunityListEntry { - /** - * The list entry\'s unique identifier - */ - 'id': number; - /** - * The entity type for this list entry - */ - 'type': OpportunityListEntryTypeEnum; - /** - * The date that the list entry was created - */ - 'createdAt': Date; - /** - * The ID of the user that created this list entry - */ - 'creatorId': number | null; - 'entity': OpportunityWithFields; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "type", - "baseName": "type", - "type": "OpportunityListEntryTypeEnum", - "format": "" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "entity", - "baseName": "entity", - "type": "OpportunityWithFields", - "format": "" - } ]; - - static getAttributeTypeMap() { - return OpportunityListEntry.attributeTypeMap; - } - - public constructor() { - } -} - -export enum OpportunityListEntryTypeEnum { - Opportunity = 'opportunity' -} - diff --git a/src/v2/generated/models/OpportunityPaged.ts b/src/v2/generated/models/OpportunityPaged.ts deleted file mode 100644 index 58e0cc3..0000000 --- a/src/v2/generated/models/OpportunityPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Opportunity } from '../models/Opportunity.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* OpportunityPaged model -*/ -export class OpportunityPaged { - /** - * A page of Opportunity results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return OpportunityPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/OpportunityWithFields.ts b/src/v2/generated/models/OpportunityWithFields.ts deleted file mode 100644 index 31d8abc..0000000 --- a/src/v2/generated/models/OpportunityWithFields.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Field } from '../models/Field.ts'; -import { HttpFile } from '../http/http.ts'; - -export class OpportunityWithFields { - /** - * The unique identifier for the opportunity - */ - 'id': number; - /** - * The name of the opportunity - */ - 'name': string; - /** - * The ID of the list that the opportunity belongs to - */ - 'listId': number; - /** - * The fields associated with the opportunity - */ - 'fields'?: Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "listId", - "baseName": "listId", - "type": "number", - "format": "int64" - }, - { - "name": "fields", - "baseName": "fields", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return OpportunityWithFields.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Pagination.ts b/src/v2/generated/models/Pagination.ts deleted file mode 100644 index 0f63a82..0000000 --- a/src/v2/generated/models/Pagination.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Pagination { - /** - * URL for the previous page - */ - 'prevUrl'?: string | null; - /** - * URL for the next page - */ - 'nextUrl'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "prevUrl", - "baseName": "prevUrl", - "type": "string", - "format": "url" - }, - { - "name": "nextUrl", - "baseName": "nextUrl", - "type": "string", - "format": "url" - } ]; - - static getAttributeTypeMap() { - return Pagination.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Person.ts b/src/v2/generated/models/Person.ts deleted file mode 100644 index 587cf82..0000000 --- a/src/v2/generated/models/Person.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Field } from '../models/Field.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* Person model -*/ -export class Person { - /** - * The persons\'s unique identifier - */ - 'id': number; - /** - * The person\'s first name - */ - 'firstName': string; - /** - * The person\'s last name - */ - 'lastName': string | null; - /** - * The person\'s primary email address - */ - 'primaryEmailAddress': string | null; - /** - * All of the person\'s email addresses - */ - 'emailAddresses': Array; - /** - * The person\'s type - */ - 'type': PersonTypeEnum; - /** - * The fields associated with the person - */ - 'fields'?: Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string", - "format": "" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string", - "format": "" - }, - { - "name": "primaryEmailAddress", - "baseName": "primaryEmailAddress", - "type": "string", - "format": "email" - }, - { - "name": "emailAddresses", - "baseName": "emailAddresses", - "type": "Array", - "format": "email" - }, - { - "name": "type", - "baseName": "type", - "type": "PersonTypeEnum", - "format": "" - }, - { - "name": "fields", - "baseName": "fields", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return Person.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PersonTypeEnum { - Internal = 'internal', - External = 'external' -} - diff --git a/src/v2/generated/models/PersonData.ts b/src/v2/generated/models/PersonData.ts deleted file mode 100644 index 81f8c26..0000000 --- a/src/v2/generated/models/PersonData.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class PersonData { - /** - * The persons\'s unique identifier - */ - 'id': number; - /** - * The person\'s first name - */ - 'firstName': string | null; - /** - * The person\'s last name - */ - 'lastName': string | null; - /** - * The person\'s primary email address - */ - 'primaryEmailAddress': string | null; - /** - * The person\'s type - */ - 'type': PersonDataTypeEnum; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string", - "format": "" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string", - "format": "" - }, - { - "name": "primaryEmailAddress", - "baseName": "primaryEmailAddress", - "type": "string", - "format": "email" - }, - { - "name": "type", - "baseName": "type", - "type": "PersonDataTypeEnum", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PersonData.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PersonDataTypeEnum { - Internal = 'internal', - External = 'external', - Collaborator = 'collaborator' -} - diff --git a/src/v2/generated/models/PersonListEntry.ts b/src/v2/generated/models/PersonListEntry.ts deleted file mode 100644 index f9281e3..0000000 --- a/src/v2/generated/models/PersonListEntry.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Person } from '../models/Person.ts'; -import { HttpFile } from '../http/http.ts'; - -export class PersonListEntry { - /** - * The list entry\'s unique identifier - */ - 'id': number; - /** - * The entity type for this list entry - */ - 'type': PersonListEntryTypeEnum; - /** - * The date that the list entry was created - */ - 'createdAt': Date; - /** - * The ID of the user that created this list entry - */ - 'creatorId': number | null; - 'entity': Person; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "type", - "baseName": "type", - "type": "PersonListEntryTypeEnum", - "format": "" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - }, - { - "name": "creatorId", - "baseName": "creatorId", - "type": "number", - "format": "int64" - }, - { - "name": "entity", - "baseName": "entity", - "type": "Person", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PersonListEntry.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PersonListEntryTypeEnum { - Person = 'person' -} - diff --git a/src/v2/generated/models/PersonPaged.ts b/src/v2/generated/models/PersonPaged.ts deleted file mode 100644 index 42aadc3..0000000 --- a/src/v2/generated/models/PersonPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Pagination } from '../models/Pagination.ts'; -import { Person } from '../models/Person.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* PersonPaged model -*/ -export class PersonPaged { - /** - * A page of Person results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PersonPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/PersonValue.ts b/src/v2/generated/models/PersonValue.ts deleted file mode 100644 index cefd953..0000000 --- a/src/v2/generated/models/PersonValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { PersonData } from '../models/PersonData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class PersonValue { - /** - * The type of value - */ - 'type': PersonValueTypeEnum; - 'data': PersonData | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "PersonValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "PersonData", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PersonValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PersonValueTypeEnum { - Person = 'person' -} - diff --git a/src/v2/generated/models/PersonsValue.ts b/src/v2/generated/models/PersonsValue.ts deleted file mode 100644 index efb40a7..0000000 --- a/src/v2/generated/models/PersonsValue.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { PersonData } from '../models/PersonData.ts'; -import { HttpFile } from '../http/http.ts'; - -export class PersonsValue { - /** - * The type of value - */ - 'type': PersonsValueTypeEnum; - /** - * The values for many persons - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "PersonsValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PersonsValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PersonsValueTypeEnum { - PersonMulti = 'person-multi' -} - diff --git a/src/v2/generated/models/PhoneCall.ts b/src/v2/generated/models/PhoneCall.ts deleted file mode 100644 index e405470..0000000 --- a/src/v2/generated/models/PhoneCall.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Attendee } from '../models/Attendee.ts'; -import { HttpFile } from '../http/http.ts'; - -export class PhoneCall { - /** - * The type of interaction - */ - 'type': PhoneCallTypeEnum; - /** - * The phon_call\'s unique identifier - */ - 'id': number; - /** - * The call start time - */ - 'startTime': Date; - /** - * People attending the call - */ - 'attendees': Array; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "PhoneCallTypeEnum", - "format": "" - }, - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "startTime", - "baseName": "startTime", - "type": "Date", - "format": "date-time" - }, - { - "name": "attendees", - "baseName": "attendees", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return PhoneCall.attributeTypeMap; - } - - public constructor() { - } -} - -export enum PhoneCallTypeEnum { - Call = 'call' -} - diff --git a/src/v2/generated/models/RankedDropdown.ts b/src/v2/generated/models/RankedDropdown.ts deleted file mode 100644 index 8f3161e..0000000 --- a/src/v2/generated/models/RankedDropdown.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class RankedDropdown { - /** - * Dropdown item\'s unique identifier - */ - 'dropdownOptionId': number; - /** - * Dropdown item text - */ - 'text': string; - /** - * Dropdown item rank - */ - 'rank': number; - /** - * Dropdown item color - */ - 'color': string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "dropdownOptionId", - "baseName": "dropdownOptionId", - "type": "number", - "format": "int64" - }, - { - "name": "text", - "baseName": "text", - "type": "string", - "format": "" - }, - { - "name": "rank", - "baseName": "rank", - "type": "number", - "format": "int64" - }, - { - "name": "color", - "baseName": "color", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return RankedDropdown.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/RankedDropdownValue.ts b/src/v2/generated/models/RankedDropdownValue.ts deleted file mode 100644 index fd038df..0000000 --- a/src/v2/generated/models/RankedDropdownValue.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { RankedDropdown } from '../models/RankedDropdown.ts'; -import { HttpFile } from '../http/http.ts'; - -export class RankedDropdownValue { - /** - * The type of value - */ - 'type': RankedDropdownValueTypeEnum; - 'data': RankedDropdown | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "RankedDropdownValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "RankedDropdown", - "format": "" - } ]; - - static getAttributeTypeMap() { - return RankedDropdownValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum RankedDropdownValueTypeEnum { - RankedDropdown = 'ranked-dropdown' -} - diff --git a/src/v2/generated/models/RateLimitError.ts b/src/v2/generated/models/RateLimitError.ts deleted file mode 100644 index 0fcd615..0000000 --- a/src/v2/generated/models/RateLimitError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class RateLimitError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return RateLimitError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/SavedView.ts b/src/v2/generated/models/SavedView.ts deleted file mode 100644 index 2c72d98..0000000 --- a/src/v2/generated/models/SavedView.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -/** -* SavedView model -*/ -export class SavedView { - /** - * The saved view\'s unique identifier - */ - 'id': number; - /** - * The saved view\'s name - */ - 'name': string; - /** - * The type for this saved view - */ - 'type': SavedViewTypeEnum; - /** - * The date that the saved view was created - */ - 'createdAt': Date; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "type", - "baseName": "type", - "type": "SavedViewTypeEnum", - "format": "" - }, - { - "name": "createdAt", - "baseName": "createdAt", - "type": "Date", - "format": "date-time" - } ]; - - static getAttributeTypeMap() { - return SavedView.attributeTypeMap; - } - - public constructor() { - } -} - -export enum SavedViewTypeEnum { - Sheet = 'sheet', - Board = 'board', - Dashboard = 'dashboard' -} - diff --git a/src/v2/generated/models/SavedViewPaged.ts b/src/v2/generated/models/SavedViewPaged.ts deleted file mode 100644 index c6dd455..0000000 --- a/src/v2/generated/models/SavedViewPaged.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Pagination } from '../models/Pagination.ts'; -import { SavedView } from '../models/SavedView.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* SavedViewPaged model -*/ -export class SavedViewPaged { - /** - * A page of SavedView results - */ - 'data': Array; - 'pagination': Pagination; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - }, - { - "name": "pagination", - "baseName": "pagination", - "type": "Pagination", - "format": "" - } ]; - - static getAttributeTypeMap() { - return SavedViewPaged.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ServerError.ts b/src/v2/generated/models/ServerError.ts deleted file mode 100644 index bd13722..0000000 --- a/src/v2/generated/models/ServerError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class ServerError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ServerError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/Tenant.ts b/src/v2/generated/models/Tenant.ts deleted file mode 100644 index 51ca803..0000000 --- a/src/v2/generated/models/Tenant.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class Tenant { - /** - * The tenant\'s unique identifier - */ - 'id': number; - /** - * The name of the tenant - */ - 'name': string; - /** - * The tenant\'s subdomain under affinity.co - */ - 'subdomain': string; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "name", - "baseName": "name", - "type": "string", - "format": "" - }, - { - "name": "subdomain", - "baseName": "subdomain", - "type": "string", - "format": "hostname" - } ]; - - static getAttributeTypeMap() { - return Tenant.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/TextValue.ts b/src/v2/generated/models/TextValue.ts deleted file mode 100644 index 6836e49..0000000 --- a/src/v2/generated/models/TextValue.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class TextValue { - /** - * The type of value - */ - 'type': TextValueTypeEnum; - /** - * The value for a string - */ - 'data': string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "TextValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return TextValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum TextValueTypeEnum { - FilterableText = 'filterable-text', - Text = 'text' -} - diff --git a/src/v2/generated/models/TextsValue.ts b/src/v2/generated/models/TextsValue.ts deleted file mode 100644 index d409613..0000000 --- a/src/v2/generated/models/TextsValue.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class TextsValue { - /** - * The type of value - */ - 'type': TextsValueTypeEnum; - /** - * The value for many strings - */ - 'data': Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "type", - "baseName": "type", - "type": "TextsValueTypeEnum", - "format": "" - }, - { - "name": "data", - "baseName": "data", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return TextsValue.attributeTypeMap; - } - - public constructor() { - } -} - -export enum TextsValueTypeEnum { - FilterableTextMulti = 'filterable-text-multi' -} - diff --git a/src/v2/generated/models/TooManyMultipartFilesError.ts b/src/v2/generated/models/TooManyMultipartFilesError.ts deleted file mode 100644 index f9ccd38..0000000 --- a/src/v2/generated/models/TooManyMultipartFilesError.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class TooManyMultipartFilesError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return TooManyMultipartFilesError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/User.ts b/src/v2/generated/models/User.ts deleted file mode 100644 index e5065b6..0000000 --- a/src/v2/generated/models/User.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class User { - /** - * The user\'s unique identifier - */ - 'id': number; - /** - * The user\'s first name - */ - 'firstName': string; - /** - * The user\'s last name - */ - 'lastName': string | null; - /** - * The user\'s email address - */ - 'emailAddress': string; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number", - "format": "int64" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string", - "format": "" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string", - "format": "" - }, - { - "name": "emailAddress", - "baseName": "emailAddress", - "type": "string", - "format": "email" - } ]; - - static getAttributeTypeMap() { - return User.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ValidationError.ts b/src/v2/generated/models/ValidationError.ts deleted file mode 100644 index 019d916..0000000 --- a/src/v2/generated/models/ValidationError.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { HttpFile } from '../http/http.ts'; - -export class ValidationError { - /** - * Error code - */ - 'code'?: string | null; - /** - * Error message - */ - 'message'?: string | null; - /** - * Param the error refers to - */ - 'param'?: string | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "string", - "format": "" - }, - { - "name": "message", - "baseName": "message", - "type": "string", - "format": "" - }, - { - "name": "param", - "baseName": "param", - "type": "string", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ValidationError.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/ValidationErrors.ts b/src/v2/generated/models/ValidationErrors.ts deleted file mode 100644 index 31ff251..0000000 --- a/src/v2/generated/models/ValidationErrors.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { ValidationError } from '../models/ValidationError.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* ValidationErrors model -*/ -export class ValidationErrors { - /** - * ValidationError errors - */ - 'errors'?: Array | null; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "errors", - "baseName": "errors", - "type": "Array", - "format": "" - } ]; - - static getAttributeTypeMap() { - return ValidationErrors.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/WhoAmI.ts b/src/v2/generated/models/WhoAmI.ts deleted file mode 100644 index 19cdd18..0000000 --- a/src/v2/generated/models/WhoAmI.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Affinity API v2 - * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. - * - * OpenAPI spec version: 2.0.0 - * Contact: support@affinity.co - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { Grant } from '../models/Grant.ts'; -import { Tenant } from '../models/Tenant.ts'; -import { User } from '../models/User.ts'; -import { HttpFile } from '../http/http.ts'; - -/** -* WhoAmI model -*/ -export class WhoAmI { - 'tenant': Tenant; - 'user': User; - 'grant': Grant; - - static readonly discriminator: string | undefined = undefined; - - static readonly mapping: {[index: string]: string} | undefined = undefined; - - static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ - { - "name": "tenant", - "baseName": "tenant", - "type": "Tenant", - "format": "" - }, - { - "name": "user", - "baseName": "user", - "type": "User", - "format": "" - }, - { - "name": "grant", - "baseName": "grant", - "type": "Grant", - "format": "" - } ]; - - static getAttributeTypeMap() { - return WhoAmI.attributeTypeMap; - } - - public constructor() { - } -} diff --git a/src/v2/generated/models/all.ts b/src/v2/generated/models/all.ts deleted file mode 100644 index bb88ec1..0000000 --- a/src/v2/generated/models/all.ts +++ /dev/null @@ -1,77 +0,0 @@ -export * from '../models/Attendee.ts' -export * from '../models/AuthenticationError.ts' -export * from '../models/AuthenticationErrors.ts' -export * from '../models/AuthorizationError.ts' -export * from '../models/AuthorizationErrors.ts' -export * from '../models/ChatMessage.ts' -export * from '../models/CompaniesValue.ts' -export * from '../models/Company.ts' -export * from '../models/CompanyData.ts' -export * from '../models/CompanyListEntry.ts' -export * from '../models/CompanyPaged.ts' -export * from '../models/CompanyValue.ts' -export * from '../models/ConflictError.ts' -export * from '../models/DateValue.ts' -export * from '../models/Dropdown.ts' -export * from '../models/DropdownValue.ts' -export * from '../models/DropdownsValue.ts' -export * from '../models/Email.ts' -export * from '../models/EmptyMessageBodyError.ts' -export * from '../models/Errors.ts' -export * from '../models/Field.ts' -export * from '../models/FieldMetadata.ts' -export * from '../models/FieldMetadataPaged.ts' -export * from '../models/FieldValue.ts' -export * from '../models/FloatValue.ts' -export * from '../models/FloatsValue.ts' -export * from '../models/FormulaNumber.ts' -export * from '../models/FormulaValue.ts' -export * from '../models/GenericError.ts' -export * from '../models/Grant.ts' -export * from '../models/Interaction.ts' -export * from '../models/InteractionValue.ts' -export * from '../models/InvalidAcceptHeaderError.ts' -export * from '../models/InvalidMessageBodyError.ts' -export * from '../models/InvalidVersionHeaderError.ts' -export * from '../models/List.ts' -export * from '../models/ListEntry.ts' -export * from '../models/ListEntryPaged.ts' -export * from '../models/ListEntryWithEntity.ts' -export * from '../models/ListEntryWithEntityPaged.ts' -export * from '../models/ListPaged.ts' -export * from '../models/ListWithType.ts' -export * from '../models/ListWithTypePaged.ts' -export * from '../models/Location.ts' -export * from '../models/LocationValue.ts' -export * from '../models/LocationsValue.ts' -export * from '../models/Meeting.ts' -export * from '../models/MethodNotAllowedError.ts' -export * from '../models/ModelError.ts' -export * from '../models/NotFoundError.ts' -export * from '../models/NotFoundErrors.ts' -export * from '../models/Opportunity.ts' -export * from '../models/OpportunityListEntry.ts' -export * from '../models/OpportunityPaged.ts' -export * from '../models/OpportunityWithFields.ts' -export * from '../models/Pagination.ts' -export * from '../models/Person.ts' -export * from '../models/PersonData.ts' -export * from '../models/PersonListEntry.ts' -export * from '../models/PersonPaged.ts' -export * from '../models/PersonValue.ts' -export * from '../models/PersonsValue.ts' -export * from '../models/PhoneCall.ts' -export * from '../models/RankedDropdown.ts' -export * from '../models/RankedDropdownValue.ts' -export * from '../models/RateLimitError.ts' -export * from '../models/SavedView.ts' -export * from '../models/SavedViewPaged.ts' -export * from '../models/ServerError.ts' -export * from '../models/Tenant.ts' -export * from '../models/TextValue.ts' -export * from '../models/TextsValue.ts' -export * from '../models/TooManyMultipartFilesError.ts' -export * from '../models/User.ts' -export * from '../models/ValidationError.ts' -export * from '../models/ValidationErrors.ts' -export * from '../models/WhoAmI.ts' diff --git a/src/v2/generated/rxjsStub.ts b/src/v2/generated/rxjsStub.ts deleted file mode 100644 index 4c73715..0000000 --- a/src/v2/generated/rxjsStub.ts +++ /dev/null @@ -1,27 +0,0 @@ -export class Observable { - constructor(private promise: Promise) {} - - toPromise() { - return this.promise; - } - - pipe(callback: (value: T) => S | Promise): Observable { - return new Observable(this.promise.then(callback)); - } -} - -export function from(promise: Promise) { - return new Observable(promise); -} - -export function of(value: T) { - return new Observable(Promise.resolve(value)); -} - -export function mergeMap(callback: (value: T) => Observable) { - return (value: T) => callback(value).toPromise(); -} - -export function map(callback: any) { - return callback; -} diff --git a/src/v2/generated/servers.ts b/src/v2/generated/servers.ts deleted file mode 100644 index 9ba74ac..0000000 --- a/src/v2/generated/servers.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { RequestContext, HttpMethod } from "./http/http.ts"; - -export interface BaseServerConfiguration { - makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; -} - -/** - * - * Represents the configuration of a server including its - * url template and variable configuration based on the url. - * - */ -export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} - - /** - * Sets the value of the variables of this server. Variables are included in - * the `url` of this ServerConfiguration in the form `{variableName}` - * - * @param variableConfiguration a partial variable configuration for the - * variables contained in the url - */ - public setVariables(variableConfiguration: Partial) { - Object.assign(this.variableConfiguration, variableConfiguration); - } - - public getConfiguration(): T { - return this.variableConfiguration - } - - private getUrl() { - let replacedUrl = this.url; - for (const key in this.variableConfiguration) { - var re = new RegExp("{" + key + "}","g"); - replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); - } - return replacedUrl - } - - /** - * Creates a new request context for this server using the url with variables - * replaced with their respective values and the endpoint of the request appended. - * - * @param endpoint the endpoint to be queried on the server - * @param httpMethod httpMethod to be used - * - */ - public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); - } -} - -export const server1 = new ServerConfiguration<{ }>("https://api.affinity.co", { }) - -export const servers = [server1]; diff --git a/src/v2/generated/types/ObjectParamAPI.ts b/src/v2/generated/types/ObjectParamAPI.ts deleted file mode 100644 index 013dde9..0000000 --- a/src/v2/generated/types/ObjectParamAPI.ts +++ /dev/null @@ -1,1010 +0,0 @@ -import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; -import { Configuration} from '../configuration.ts' - -import { Attendee } from '../models/Attendee.ts'; -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { ChatMessage } from '../models/ChatMessage.ts'; -import { CompaniesValue } from '../models/CompaniesValue.ts'; -import { Company } from '../models/Company.ts'; -import { CompanyData } from '../models/CompanyData.ts'; -import { CompanyListEntry } from '../models/CompanyListEntry.ts'; -import { CompanyPaged } from '../models/CompanyPaged.ts'; -import { CompanyValue } from '../models/CompanyValue.ts'; -import { ConflictError } from '../models/ConflictError.ts'; -import { DateValue } from '../models/DateValue.ts'; -import { Dropdown } from '../models/Dropdown.ts'; -import { DropdownValue } from '../models/DropdownValue.ts'; -import { DropdownsValue } from '../models/DropdownsValue.ts'; -import { Email } from '../models/Email.ts'; -import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; -import { Errors } from '../models/Errors.ts'; -import { Field } from '../models/Field.ts'; -import { FieldMetadata } from '../models/FieldMetadata.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { FieldValue } from '../models/FieldValue.ts'; -import { FloatValue } from '../models/FloatValue.ts'; -import { FloatsValue } from '../models/FloatsValue.ts'; -import { FormulaNumber } from '../models/FormulaNumber.ts'; -import { FormulaValue } from '../models/FormulaValue.ts'; -import { GenericError } from '../models/GenericError.ts'; -import { Grant } from '../models/Grant.ts'; -import { Interaction } from '../models/Interaction.ts'; -import { InteractionValue } from '../models/InteractionValue.ts'; -import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; -import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; -import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; -import { List } from '../models/List.ts'; -import { ListEntry } from '../models/ListEntry.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; -import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { ListWithType } from '../models/ListWithType.ts'; -import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; -import { Location } from '../models/Location.ts'; -import { LocationValue } from '../models/LocationValue.ts'; -import { LocationsValue } from '../models/LocationsValue.ts'; -import { Meeting } from '../models/Meeting.ts'; -import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; -import { ModelError } from '../models/ModelError.ts'; -import { NotFoundError } from '../models/NotFoundError.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Opportunity } from '../models/Opportunity.ts'; -import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; -import { OpportunityPaged } from '../models/OpportunityPaged.ts'; -import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { Person } from '../models/Person.ts'; -import { PersonData } from '../models/PersonData.ts'; -import { PersonListEntry } from '../models/PersonListEntry.ts'; -import { PersonPaged } from '../models/PersonPaged.ts'; -import { PersonValue } from '../models/PersonValue.ts'; -import { PersonsValue } from '../models/PersonsValue.ts'; -import { PhoneCall } from '../models/PhoneCall.ts'; -import { RankedDropdown } from '../models/RankedDropdown.ts'; -import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; -import { RateLimitError } from '../models/RateLimitError.ts'; -import { SavedView } from '../models/SavedView.ts'; -import { SavedViewPaged } from '../models/SavedViewPaged.ts'; -import { ServerError } from '../models/ServerError.ts'; -import { Tenant } from '../models/Tenant.ts'; -import { TextValue } from '../models/TextValue.ts'; -import { TextsValue } from '../models/TextsValue.ts'; -import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; -import { User } from '../models/User.ts'; -import { ValidationError } from '../models/ValidationError.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; -import { WhoAmI } from '../models/WhoAmI.ts'; - -import { ObservableAuthApi } from "./ObservableAPI.ts"; -import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; - -export interface AuthApiGetV2AuthWhoamiRequest { -} - -export class ObjectAuthApi { - private api: ObservableAuthApi - - public constructor(configuration: Configuration, requestFactory?: AuthApiRequestFactory, responseProcessor?: AuthApiResponseProcessor) { - this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); - } - - /** - * Returns metadata about the current user. - * Get current user - * @param param the request object - */ - public getV2AuthWhoamiWithHttpInfo(param: AuthApiGetV2AuthWhoamiRequest = {}, options?: Configuration): Promise> { - return this.api.getV2AuthWhoamiWithHttpInfo( options).toPromise(); - } - - /** - * Returns metadata about the current user. - * Get current user - * @param param the request object - */ - public getV2AuthWhoami(param: AuthApiGetV2AuthWhoamiRequest = {}, options?: Configuration): Promise { - return this.api.getV2AuthWhoami( options).toPromise(); - } - -} - -import { ObservableCompaniesApi } from "./ObservableAPI.ts"; -import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; - -export interface CompaniesApiGetV2CompaniesRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof CompaniesApigetV2Companies - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof CompaniesApigetV2Companies - */ - limit?: number - /** - * Company IDs - * Defaults to: undefined - * @type Array<number> - * @memberof CompaniesApigetV2Companies - */ - ids?: Array - /** - * Field IDs for which to return field data - * Defaults to: undefined - * @type Array<string> - * @memberof CompaniesApigetV2Companies - */ - fieldIds?: Array - /** - * Field Types for which to return field data - * Defaults to: undefined - * @type Array<'enriched' | 'global' | 'relationship-intelligence'> - * @memberof CompaniesApigetV2Companies - */ - fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> -} - -export interface CompaniesApiGetV2CompaniesFieldsRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof CompaniesApigetV2CompaniesFields - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof CompaniesApigetV2CompaniesFields - */ - limit?: number -} - -export interface CompaniesApiGetV2CompaniesIdRequest { - /** - * Company ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof CompaniesApigetV2CompaniesId - */ - id: number - /** - * Field IDs for which to return field data - * Defaults to: undefined - * @type Array<string> - * @memberof CompaniesApigetV2CompaniesId - */ - fieldIds?: Array - /** - * Field Types for which to return field data - * Defaults to: undefined - * @type Array<'enriched' | 'global' | 'relationship-intelligence'> - * @memberof CompaniesApigetV2CompaniesId - */ - fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> -} - -export interface CompaniesApiGetV2CompaniesIdListEntriesRequest { - /** - * Company ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof CompaniesApigetV2CompaniesIdListEntries - */ - id: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof CompaniesApigetV2CompaniesIdListEntries - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof CompaniesApigetV2CompaniesIdListEntries - */ - limit?: number -} - -export interface CompaniesApiGetV2CompaniesIdListsRequest { - /** - * Company ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof CompaniesApigetV2CompaniesIdLists - */ - id: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof CompaniesApigetV2CompaniesIdLists - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof CompaniesApigetV2CompaniesIdLists - */ - limit?: number -} - -export class ObjectCompaniesApi { - private api: ObservableCompaniesApi - - public constructor(configuration: Configuration, requestFactory?: CompaniesApiRequestFactory, responseProcessor?: CompaniesApiResponseProcessor) { - this.api = new ObservableCompaniesApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param param the request object - */ - public getV2CompaniesWithHttpInfo(param: CompaniesApiGetV2CompaniesRequest = {}, options?: Configuration): Promise> { - return this.api.getV2CompaniesWithHttpInfo(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param param the request object - */ - public getV2Companies(param: CompaniesApiGetV2CompaniesRequest = {}, options?: Configuration): Promise { - return this.api.getV2Companies(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param param the request object - */ - public getV2CompaniesFieldsWithHttpInfo(param: CompaniesApiGetV2CompaniesFieldsRequest = {}, options?: Configuration): Promise> { - return this.api.getV2CompaniesFieldsWithHttpInfo(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param param the request object - */ - public getV2CompaniesFields(param: CompaniesApiGetV2CompaniesFieldsRequest = {}, options?: Configuration): Promise { - return this.api.getV2CompaniesFields(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param param the request object - */ - public getV2CompaniesIdWithHttpInfo(param: CompaniesApiGetV2CompaniesIdRequest, options?: Configuration): Promise> { - return this.api.getV2CompaniesIdWithHttpInfo(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param param the request object - */ - public getV2CompaniesId(param: CompaniesApiGetV2CompaniesIdRequest, options?: Configuration): Promise { - return this.api.getV2CompaniesId(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param param the request object - */ - public getV2CompaniesIdListEntriesWithHttpInfo(param: CompaniesApiGetV2CompaniesIdListEntriesRequest, options?: Configuration): Promise> { - return this.api.getV2CompaniesIdListEntriesWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param param the request object - */ - public getV2CompaniesIdListEntries(param: CompaniesApiGetV2CompaniesIdListEntriesRequest, options?: Configuration): Promise { - return this.api.getV2CompaniesIdListEntries(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param param the request object - */ - public getV2CompaniesIdListsWithHttpInfo(param: CompaniesApiGetV2CompaniesIdListsRequest, options?: Configuration): Promise> { - return this.api.getV2CompaniesIdListsWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param param the request object - */ - public getV2CompaniesIdLists(param: CompaniesApiGetV2CompaniesIdListsRequest, options?: Configuration): Promise { - return this.api.getV2CompaniesIdLists(param.id, param.cursor, param.limit, options).toPromise(); - } - -} - -import { ObservableListsApi } from "./ObservableAPI.ts"; -import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; - -export interface ListsApiGetV2ListsRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof ListsApigetV2Lists - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof ListsApigetV2Lists - */ - limit?: number -} - -export interface ListsApiGetV2ListsListidRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListid - */ - listId: number -} - -export interface ListsApiGetV2ListsListidFieldsRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidFields - */ - listId: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof ListsApigetV2ListsListidFields - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof ListsApigetV2ListsListidFields - */ - limit?: number -} - -export interface ListsApiGetV2ListsListidListEntriesRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidListEntries - */ - listId: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof ListsApigetV2ListsListidListEntries - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof ListsApigetV2ListsListidListEntries - */ - limit?: number - /** - * Field IDs for which to return field data - * Defaults to: undefined - * @type Array<string> - * @memberof ListsApigetV2ListsListidListEntries - */ - fieldIds?: Array - /** - * Field Types for which to return field data - * Defaults to: undefined - * @type Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'> - * @memberof ListsApigetV2ListsListidListEntries - */ - fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'> -} - -export interface ListsApiGetV2ListsListidSavedViewsRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidSavedViews - */ - listId: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof ListsApigetV2ListsListidSavedViews - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof ListsApigetV2ListsListidSavedViews - */ - limit?: number -} - -export interface ListsApiGetV2ListsListidSavedViewsViewidRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidSavedViewsViewid - */ - listId: number - /** - * Saved view ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidSavedViewsViewid - */ - viewId: number -} - -export interface ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest { - /** - * List ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries - */ - listId: number - /** - * Saved view ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries - */ - viewId: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries - */ - limit?: number -} - -export class ObjectListsApi { - private api: ObservableListsApi - - public constructor(configuration: Configuration, requestFactory?: ListsApiRequestFactory, responseProcessor?: ListsApiResponseProcessor) { - this.api = new ObservableListsApi(configuration, requestFactory, responseProcessor); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param param the request object - */ - public getV2ListsWithHttpInfo(param: ListsApiGetV2ListsRequest = {}, options?: Configuration): Promise> { - return this.api.getV2ListsWithHttpInfo(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param param the request object - */ - public getV2Lists(param: ListsApiGetV2ListsRequest = {}, options?: Configuration): Promise { - return this.api.getV2Lists(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param param the request object - */ - public getV2ListsListidWithHttpInfo(param: ListsApiGetV2ListsListidRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidWithHttpInfo(param.listId, options).toPromise(); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param param the request object - */ - public getV2ListsListid(param: ListsApiGetV2ListsListidRequest, options?: Configuration): Promise { - return this.api.getV2ListsListid(param.listId, options).toPromise(); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param param the request object - */ - public getV2ListsListidFieldsWithHttpInfo(param: ListsApiGetV2ListsListidFieldsRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidFieldsWithHttpInfo(param.listId, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param param the request object - */ - public getV2ListsListidFields(param: ListsApiGetV2ListsListidFieldsRequest, options?: Configuration): Promise { - return this.api.getV2ListsListidFields(param.listId, param.cursor, param.limit, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param param the request object - */ - public getV2ListsListidListEntriesWithHttpInfo(param: ListsApiGetV2ListsListidListEntriesRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidListEntriesWithHttpInfo(param.listId, param.cursor, param.limit, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param param the request object - */ - public getV2ListsListidListEntries(param: ListsApiGetV2ListsListidListEntriesRequest, options?: Configuration): Promise { - return this.api.getV2ListsListidListEntries(param.listId, param.cursor, param.limit, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param param the request object - */ - public getV2ListsListidSavedViewsWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidSavedViewsWithHttpInfo(param.listId, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param param the request object - */ - public getV2ListsListidSavedViews(param: ListsApiGetV2ListsListidSavedViewsRequest, options?: Configuration): Promise { - return this.api.getV2ListsListidSavedViews(param.listId, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param param the request object - */ - public getV2ListsListidSavedViewsViewidWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsViewidRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidSavedViewsViewidWithHttpInfo(param.listId, param.viewId, options).toPromise(); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param param the request object - */ - public getV2ListsListidSavedViewsViewid(param: ListsApiGetV2ListsListidSavedViewsViewidRequest, options?: Configuration): Promise { - return this.api.getV2ListsListidSavedViewsViewid(param.listId, param.viewId, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param param the request object - */ - public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, options?: Configuration): Promise> { - return this.api.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(param.listId, param.viewId, param.cursor, param.limit, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param param the request object - */ - public getV2ListsListidSavedViewsViewidListEntries(param: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, options?: Configuration): Promise { - return this.api.getV2ListsListidSavedViewsViewidListEntries(param.listId, param.viewId, param.cursor, param.limit, options).toPromise(); - } - -} - -import { ObservableOpportunitiesApi } from "./ObservableAPI.ts"; -import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; - -export interface OpportunitiesApiGetV2OpportunitiesRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof OpportunitiesApigetV2Opportunities - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof OpportunitiesApigetV2Opportunities - */ - limit?: number - /** - * Opportunity IDs - * Defaults to: undefined - * @type Array<number> - * @memberof OpportunitiesApigetV2Opportunities - */ - ids?: Array -} - -export interface OpportunitiesApiGetV2OpportunitiesIdRequest { - /** - * Opportunity ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof OpportunitiesApigetV2OpportunitiesId - */ - id: number -} - -export class ObjectOpportunitiesApi { - private api: ObservableOpportunitiesApi - - public constructor(configuration: Configuration, requestFactory?: OpportunitiesApiRequestFactory, responseProcessor?: OpportunitiesApiResponseProcessor) { - this.api = new ObservableOpportunitiesApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param param the request object - */ - public getV2OpportunitiesWithHttpInfo(param: OpportunitiesApiGetV2OpportunitiesRequest = {}, options?: Configuration): Promise> { - return this.api.getV2OpportunitiesWithHttpInfo(param.cursor, param.limit, param.ids, options).toPromise(); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param param the request object - */ - public getV2Opportunities(param: OpportunitiesApiGetV2OpportunitiesRequest = {}, options?: Configuration): Promise { - return this.api.getV2Opportunities(param.cursor, param.limit, param.ids, options).toPromise(); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param param the request object - */ - public getV2OpportunitiesIdWithHttpInfo(param: OpportunitiesApiGetV2OpportunitiesIdRequest, options?: Configuration): Promise> { - return this.api.getV2OpportunitiesIdWithHttpInfo(param.id, options).toPromise(); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param param the request object - */ - public getV2OpportunitiesId(param: OpportunitiesApiGetV2OpportunitiesIdRequest, options?: Configuration): Promise { - return this.api.getV2OpportunitiesId(param.id, options).toPromise(); - } - -} - -import { ObservablePersonsApi } from "./ObservableAPI.ts"; -import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; - -export interface PersonsApiGetV2PersonsRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof PersonsApigetV2Persons - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof PersonsApigetV2Persons - */ - limit?: number - /** - * People IDs - * Defaults to: undefined - * @type Array<number> - * @memberof PersonsApigetV2Persons - */ - ids?: Array - /** - * Field IDs for which to return field data - * Defaults to: undefined - * @type Array<string> - * @memberof PersonsApigetV2Persons - */ - fieldIds?: Array - /** - * Field Types for which to return field data - * Defaults to: undefined - * @type Array<'enriched' | 'global' | 'relationship-intelligence'> - * @memberof PersonsApigetV2Persons - */ - fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> -} - -export interface PersonsApiGetV2PersonsFieldsRequest { - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof PersonsApigetV2PersonsFields - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof PersonsApigetV2PersonsFields - */ - limit?: number -} - -export interface PersonsApiGetV2PersonsIdRequest { - /** - * Person ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof PersonsApigetV2PersonsId - */ - id: number - /** - * Field IDs for which to return field data - * Defaults to: undefined - * @type Array<string> - * @memberof PersonsApigetV2PersonsId - */ - fieldIds?: Array - /** - * Field Types for which to return field data - * Defaults to: undefined - * @type Array<'enriched' | 'global' | 'relationship-intelligence'> - * @memberof PersonsApigetV2PersonsId - */ - fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> -} - -export interface PersonsApiGetV2PersonsIdListEntriesRequest { - /** - * Persons ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof PersonsApigetV2PersonsIdListEntries - */ - id: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof PersonsApigetV2PersonsIdListEntries - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof PersonsApigetV2PersonsIdListEntries - */ - limit?: number -} - -export interface PersonsApiGetV2PersonsIdListsRequest { - /** - * Persons ID - * Minimum: 1 - * Maximum: -9223372036854775616 - * Defaults to: undefined - * @type number - * @memberof PersonsApigetV2PersonsIdLists - */ - id: number - /** - * Cursor for the next or previous page - * Defaults to: undefined - * @type string - * @memberof PersonsApigetV2PersonsIdLists - */ - cursor?: string - /** - * Number of items to include in the page - * Minimum: 1 - * Maximum: 100 - * Defaults to: 100 - * @type number - * @memberof PersonsApigetV2PersonsIdLists - */ - limit?: number -} - -export class ObjectPersonsApi { - private api: ObservablePersonsApi - - public constructor(configuration: Configuration, requestFactory?: PersonsApiRequestFactory, responseProcessor?: PersonsApiResponseProcessor) { - this.api = new ObservablePersonsApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param param the request object - */ - public getV2PersonsWithHttpInfo(param: PersonsApiGetV2PersonsRequest = {}, options?: Configuration): Promise> { - return this.api.getV2PersonsWithHttpInfo(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param param the request object - */ - public getV2Persons(param: PersonsApiGetV2PersonsRequest = {}, options?: Configuration): Promise { - return this.api.getV2Persons(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param param the request object - */ - public getV2PersonsFieldsWithHttpInfo(param: PersonsApiGetV2PersonsFieldsRequest = {}, options?: Configuration): Promise> { - return this.api.getV2PersonsFieldsWithHttpInfo(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param param the request object - */ - public getV2PersonsFields(param: PersonsApiGetV2PersonsFieldsRequest = {}, options?: Configuration): Promise { - return this.api.getV2PersonsFields(param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param param the request object - */ - public getV2PersonsIdWithHttpInfo(param: PersonsApiGetV2PersonsIdRequest, options?: Configuration): Promise> { - return this.api.getV2PersonsIdWithHttpInfo(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param param the request object - */ - public getV2PersonsId(param: PersonsApiGetV2PersonsIdRequest, options?: Configuration): Promise { - return this.api.getV2PersonsId(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param param the request object - */ - public getV2PersonsIdListEntriesWithHttpInfo(param: PersonsApiGetV2PersonsIdListEntriesRequest, options?: Configuration): Promise> { - return this.api.getV2PersonsIdListEntriesWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param param the request object - */ - public getV2PersonsIdListEntries(param: PersonsApiGetV2PersonsIdListEntriesRequest, options?: Configuration): Promise { - return this.api.getV2PersonsIdListEntries(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param param the request object - */ - public getV2PersonsIdListsWithHttpInfo(param: PersonsApiGetV2PersonsIdListsRequest, options?: Configuration): Promise> { - return this.api.getV2PersonsIdListsWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param param the request object - */ - public getV2PersonsIdLists(param: PersonsApiGetV2PersonsIdListsRequest, options?: Configuration): Promise { - return this.api.getV2PersonsIdLists(param.id, param.cursor, param.limit, options).toPromise(); - } - -} diff --git a/src/v2/generated/types/ObservableAPI.ts b/src/v2/generated/types/ObservableAPI.ts deleted file mode 100644 index c0c5ca1..0000000 --- a/src/v2/generated/types/ObservableAPI.ts +++ /dev/null @@ -1,903 +0,0 @@ -import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; -import { Configuration} from '../configuration.ts' -import { Observable, of, from } from '../rxjsStub.ts'; -import {mergeMap, map} from '../rxjsStub.ts'; -import { Attendee } from '../models/Attendee.ts'; -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { ChatMessage } from '../models/ChatMessage.ts'; -import { CompaniesValue } from '../models/CompaniesValue.ts'; -import { Company } from '../models/Company.ts'; -import { CompanyData } from '../models/CompanyData.ts'; -import { CompanyListEntry } from '../models/CompanyListEntry.ts'; -import { CompanyPaged } from '../models/CompanyPaged.ts'; -import { CompanyValue } from '../models/CompanyValue.ts'; -import { ConflictError } from '../models/ConflictError.ts'; -import { DateValue } from '../models/DateValue.ts'; -import { Dropdown } from '../models/Dropdown.ts'; -import { DropdownValue } from '../models/DropdownValue.ts'; -import { DropdownsValue } from '../models/DropdownsValue.ts'; -import { Email } from '../models/Email.ts'; -import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; -import { Errors } from '../models/Errors.ts'; -import { Field } from '../models/Field.ts'; -import { FieldMetadata } from '../models/FieldMetadata.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { FieldValue } from '../models/FieldValue.ts'; -import { FloatValue } from '../models/FloatValue.ts'; -import { FloatsValue } from '../models/FloatsValue.ts'; -import { FormulaNumber } from '../models/FormulaNumber.ts'; -import { FormulaValue } from '../models/FormulaValue.ts'; -import { GenericError } from '../models/GenericError.ts'; -import { Grant } from '../models/Grant.ts'; -import { Interaction } from '../models/Interaction.ts'; -import { InteractionValue } from '../models/InteractionValue.ts'; -import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; -import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; -import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; -import { List } from '../models/List.ts'; -import { ListEntry } from '../models/ListEntry.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; -import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { ListWithType } from '../models/ListWithType.ts'; -import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; -import { Location } from '../models/Location.ts'; -import { LocationValue } from '../models/LocationValue.ts'; -import { LocationsValue } from '../models/LocationsValue.ts'; -import { Meeting } from '../models/Meeting.ts'; -import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; -import { ModelError } from '../models/ModelError.ts'; -import { NotFoundError } from '../models/NotFoundError.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Opportunity } from '../models/Opportunity.ts'; -import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; -import { OpportunityPaged } from '../models/OpportunityPaged.ts'; -import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { Person } from '../models/Person.ts'; -import { PersonData } from '../models/PersonData.ts'; -import { PersonListEntry } from '../models/PersonListEntry.ts'; -import { PersonPaged } from '../models/PersonPaged.ts'; -import { PersonValue } from '../models/PersonValue.ts'; -import { PersonsValue } from '../models/PersonsValue.ts'; -import { PhoneCall } from '../models/PhoneCall.ts'; -import { RankedDropdown } from '../models/RankedDropdown.ts'; -import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; -import { RateLimitError } from '../models/RateLimitError.ts'; -import { SavedView } from '../models/SavedView.ts'; -import { SavedViewPaged } from '../models/SavedViewPaged.ts'; -import { ServerError } from '../models/ServerError.ts'; -import { Tenant } from '../models/Tenant.ts'; -import { TextValue } from '../models/TextValue.ts'; -import { TextsValue } from '../models/TextsValue.ts'; -import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; -import { User } from '../models/User.ts'; -import { ValidationError } from '../models/ValidationError.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; -import { WhoAmI } from '../models/WhoAmI.ts'; - -import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; -export class ObservableAuthApi { - private requestFactory: AuthApiRequestFactory; - private responseProcessor: AuthApiResponseProcessor; - private configuration: Configuration; - - public constructor( - configuration: Configuration, - requestFactory?: AuthApiRequestFactory, - responseProcessor?: AuthApiResponseProcessor - ) { - this.configuration = configuration; - this.requestFactory = requestFactory || new AuthApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new AuthApiResponseProcessor(); - } - - /** - * Returns metadata about the current user. - * Get current user - */ - public getV2AuthWhoamiWithHttpInfo(_options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2AuthWhoami(_options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2AuthWhoamiWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata about the current user. - * Get current user - */ - public getV2AuthWhoami(_options?: Configuration): Observable { - return this.getV2AuthWhoamiWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - -} - -import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; -export class ObservableCompaniesApi { - private requestFactory: CompaniesApiRequestFactory; - private responseProcessor: CompaniesApiResponseProcessor; - private configuration: Configuration; - - public constructor( - configuration: Configuration, - requestFactory?: CompaniesApiRequestFactory, - responseProcessor?: CompaniesApiResponseProcessor - ) { - this.configuration = configuration; - this.requestFactory = requestFactory || new CompaniesApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new CompaniesApiResponseProcessor(); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Company IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2Companies(cursor, limit, ids, fieldIds, fieldTypes, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Company IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { - return this.getV2CompaniesWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2CompaniesFields(cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesFieldsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2CompaniesFieldsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param id Company ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2CompaniesId(id, fieldIds, fieldTypes, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdWithHttpInfo(rsp))); - })); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param id Company ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { - return this.getV2CompaniesIdWithHttpInfo(id, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2CompaniesIdListEntries(id, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdListEntriesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2CompaniesIdListEntriesWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2CompaniesIdLists(id, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdListsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2CompaniesIdListsWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - -} - -import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; -export class ObservableListsApi { - private requestFactory: ListsApiRequestFactory; - private responseProcessor: ListsApiResponseProcessor; - private configuration: Configuration; - - public constructor( - configuration: Configuration, - requestFactory?: ListsApiRequestFactory, - responseProcessor?: ListsApiResponseProcessor - ) { - this.configuration = configuration; - this.requestFactory = requestFactory || new ListsApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new ListsApiResponseProcessor(); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2Lists(cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2ListsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param listId List ID - */ - public getV2ListsListidWithHttpInfo(listId: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListid(listId, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param listId List ID - */ - public getV2ListsListid(listId: number, _options?: Configuration): Observable { - return this.getV2ListsListidWithHttpInfo(listId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidFieldsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListidFields(listId, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidFieldsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2ListsListidFieldsWithHttpInfo(listId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2ListsListidListEntriesWithHttpInfo(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListidListEntries(listId, cursor, limit, fieldIds, fieldTypes, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidListEntriesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Observable { - return this.getV2ListsListidListEntriesWithHttpInfo(listId, cursor, limit, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListidSavedViews(listId, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2ListsListidSavedViewsWithHttpInfo(listId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param listId List ID - * @param viewId Saved view ID - */ - public getV2ListsListidSavedViewsViewidWithHttpInfo(listId: number, viewId: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListidSavedViewsViewid(listId, viewId, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsViewidWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param listId List ID - * @param viewId Saved view ID - */ - public getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Observable { - return this.getV2ListsListidSavedViewsViewidWithHttpInfo(listId, viewId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param listId List ID - * @param viewId Saved view ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2ListsListidSavedViewsViewidListEntries(listId, viewId, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param listId List ID - * @param viewId Saved view ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId, viewId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - -} - -import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; -export class ObservableOpportunitiesApi { - private requestFactory: OpportunitiesApiRequestFactory; - private responseProcessor: OpportunitiesApiResponseProcessor; - private configuration: Configuration; - - public constructor( - configuration: Configuration, - requestFactory?: OpportunitiesApiRequestFactory, - responseProcessor?: OpportunitiesApiResponseProcessor - ) { - this.configuration = configuration; - this.requestFactory = requestFactory || new OpportunitiesApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new OpportunitiesApiResponseProcessor(); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Opportunity IDs - */ - public getV2OpportunitiesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2Opportunities(cursor, limit, ids, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2OpportunitiesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Opportunity IDs - */ - public getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Observable { - return this.getV2OpportunitiesWithHttpInfo(cursor, limit, ids, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param id Opportunity ID - */ - public getV2OpportunitiesIdWithHttpInfo(id: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2OpportunitiesId(id, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2OpportunitiesIdWithHttpInfo(rsp))); - })); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param id Opportunity ID - */ - public getV2OpportunitiesId(id: number, _options?: Configuration): Observable { - return this.getV2OpportunitiesIdWithHttpInfo(id, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - -} - -import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; -export class ObservablePersonsApi { - private requestFactory: PersonsApiRequestFactory; - private responseProcessor: PersonsApiResponseProcessor; - private configuration: Configuration; - - public constructor( - configuration: Configuration, - requestFactory?: PersonsApiRequestFactory, - responseProcessor?: PersonsApiResponseProcessor - ) { - this.configuration = configuration; - this.requestFactory = requestFactory || new PersonsApiRequestFactory(configuration); - this.responseProcessor = responseProcessor || new PersonsApiResponseProcessor(); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] People IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2Persons(cursor, limit, ids, fieldIds, fieldTypes, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] People IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { - return this.getV2PersonsWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2PersonsFields(cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsFieldsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2PersonsFieldsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param id Person ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2PersonsId(id, fieldIds, fieldTypes, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdWithHttpInfo(rsp))); - })); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param id Person ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { - return this.getV2PersonsIdWithHttpInfo(id, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2PersonsIdListEntries(id, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdListEntriesWithHttpInfo(rsp))); - })); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2PersonsIdListEntriesWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.getV2PersonsIdLists(id, cursor, limit, _options); - - // build promise chain - let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { - middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); - } - - return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). - pipe(mergeMap((response: ResponseContext) => { - let middlewarePostObservable = of(response); - for (const middleware of this.configuration.middleware) { - middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); - } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdListsWithHttpInfo(rsp))); - })); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { - return this.getV2PersonsIdListsWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); - } - -} diff --git a/src/v2/generated/types/PromiseAPI.ts b/src/v2/generated/types/PromiseAPI.ts deleted file mode 100644 index e2881af..0000000 --- a/src/v2/generated/types/PromiseAPI.ts +++ /dev/null @@ -1,647 +0,0 @@ -import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; -import { Configuration} from '../configuration.ts' - -import { Attendee } from '../models/Attendee.ts'; -import { AuthenticationError } from '../models/AuthenticationError.ts'; -import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; -import { AuthorizationError } from '../models/AuthorizationError.ts'; -import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; -import { ChatMessage } from '../models/ChatMessage.ts'; -import { CompaniesValue } from '../models/CompaniesValue.ts'; -import { Company } from '../models/Company.ts'; -import { CompanyData } from '../models/CompanyData.ts'; -import { CompanyListEntry } from '../models/CompanyListEntry.ts'; -import { CompanyPaged } from '../models/CompanyPaged.ts'; -import { CompanyValue } from '../models/CompanyValue.ts'; -import { ConflictError } from '../models/ConflictError.ts'; -import { DateValue } from '../models/DateValue.ts'; -import { Dropdown } from '../models/Dropdown.ts'; -import { DropdownValue } from '../models/DropdownValue.ts'; -import { DropdownsValue } from '../models/DropdownsValue.ts'; -import { Email } from '../models/Email.ts'; -import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; -import { Errors } from '../models/Errors.ts'; -import { Field } from '../models/Field.ts'; -import { FieldMetadata } from '../models/FieldMetadata.ts'; -import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; -import { FieldValue } from '../models/FieldValue.ts'; -import { FloatValue } from '../models/FloatValue.ts'; -import { FloatsValue } from '../models/FloatsValue.ts'; -import { FormulaNumber } from '../models/FormulaNumber.ts'; -import { FormulaValue } from '../models/FormulaValue.ts'; -import { GenericError } from '../models/GenericError.ts'; -import { Grant } from '../models/Grant.ts'; -import { Interaction } from '../models/Interaction.ts'; -import { InteractionValue } from '../models/InteractionValue.ts'; -import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; -import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; -import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; -import { List } from '../models/List.ts'; -import { ListEntry } from '../models/ListEntry.ts'; -import { ListEntryPaged } from '../models/ListEntryPaged.ts'; -import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; -import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; -import { ListPaged } from '../models/ListPaged.ts'; -import { ListWithType } from '../models/ListWithType.ts'; -import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; -import { Location } from '../models/Location.ts'; -import { LocationValue } from '../models/LocationValue.ts'; -import { LocationsValue } from '../models/LocationsValue.ts'; -import { Meeting } from '../models/Meeting.ts'; -import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; -import { ModelError } from '../models/ModelError.ts'; -import { NotFoundError } from '../models/NotFoundError.ts'; -import { NotFoundErrors } from '../models/NotFoundErrors.ts'; -import { Opportunity } from '../models/Opportunity.ts'; -import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; -import { OpportunityPaged } from '../models/OpportunityPaged.ts'; -import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; -import { Pagination } from '../models/Pagination.ts'; -import { Person } from '../models/Person.ts'; -import { PersonData } from '../models/PersonData.ts'; -import { PersonListEntry } from '../models/PersonListEntry.ts'; -import { PersonPaged } from '../models/PersonPaged.ts'; -import { PersonValue } from '../models/PersonValue.ts'; -import { PersonsValue } from '../models/PersonsValue.ts'; -import { PhoneCall } from '../models/PhoneCall.ts'; -import { RankedDropdown } from '../models/RankedDropdown.ts'; -import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; -import { RateLimitError } from '../models/RateLimitError.ts'; -import { SavedView } from '../models/SavedView.ts'; -import { SavedViewPaged } from '../models/SavedViewPaged.ts'; -import { ServerError } from '../models/ServerError.ts'; -import { Tenant } from '../models/Tenant.ts'; -import { TextValue } from '../models/TextValue.ts'; -import { TextsValue } from '../models/TextsValue.ts'; -import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; -import { User } from '../models/User.ts'; -import { ValidationError } from '../models/ValidationError.ts'; -import { ValidationErrors } from '../models/ValidationErrors.ts'; -import { WhoAmI } from '../models/WhoAmI.ts'; -import { ObservableAuthApi } from './ObservableAPI.ts'; - -import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; -export class PromiseAuthApi { - private api: ObservableAuthApi - - public constructor( - configuration: Configuration, - requestFactory?: AuthApiRequestFactory, - responseProcessor?: AuthApiResponseProcessor - ) { - this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); - } - - /** - * Returns metadata about the current user. - * Get current user - */ - public getV2AuthWhoamiWithHttpInfo(_options?: Configuration): Promise> { - const result = this.api.getV2AuthWhoamiWithHttpInfo(_options); - return result.toPromise(); - } - - /** - * Returns metadata about the current user. - * Get current user - */ - public getV2AuthWhoami(_options?: Configuration): Promise { - const result = this.api.getV2AuthWhoami(_options); - return result.toPromise(); - } - - -} - - - -import { ObservableCompaniesApi } from './ObservableAPI.ts'; - -import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; -export class PromiseCompaniesApi { - private api: ObservableCompaniesApi - - public constructor( - configuration: Configuration, - requestFactory?: CompaniesApiRequestFactory, - responseProcessor?: CompaniesApiResponseProcessor - ) { - this.api = new ObservableCompaniesApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Company IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { - const result = this.api.getV2CompaniesWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get all Companies - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Company IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - const result = this.api.getV2Companies(cursor, limit, ids, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2CompaniesFieldsWithHttpInfo(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. - * Get metadata on Company Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2CompaniesFields(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param id Company ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { - const result = this.api.getV2CompaniesIdWithHttpInfo(id, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Company - * @param id Company ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - const result = this.api.getV2CompaniesId(id, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2CompaniesIdListEntriesWithHttpInfo(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Company\'s List Entries - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2CompaniesIdListEntries(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2CompaniesIdListsWithHttpInfo(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Company appears. - * Get a Company\'s Lists - * @param id Company ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2CompaniesIdLists(id, cursor, limit, _options); - return result.toPromise(); - } - - -} - - - -import { ObservableListsApi } from './ObservableAPI.ts'; - -import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; -export class PromiseListsApi { - private api: ObservableListsApi - - public constructor( - configuration: Configuration, - requestFactory?: ListsApiRequestFactory, - responseProcessor?: ListsApiResponseProcessor - ) { - this.api = new ObservableListsApi(configuration, requestFactory, responseProcessor); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsWithHttpInfo(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on Lists. - * Get metadata on all Lists - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2Lists(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param listId List ID - */ - public getV2ListsListidWithHttpInfo(listId: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidWithHttpInfo(listId, _options); - return result.toPromise(); - } - - /** - * Returns metadata on a single List. - * Get metadata on a single List - * @param listId List ID - */ - public getV2ListsListid(listId: number, _options?: Configuration): Promise { - const result = this.api.getV2ListsListid(listId, _options); - return result.toPromise(); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidFieldsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidFieldsWithHttpInfo(listId, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. - * Get metadata on a single List\'s Fields - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2ListsListidFields(listId, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2ListsListidListEntriesWithHttpInfo(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidListEntriesWithHttpInfo(listId, cursor, limit, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a List - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise { - const result = this.api.getV2ListsListidListEntries(listId, cursor, limit, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidSavedViewsWithHttpInfo(listId, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on the Saved Views on a List. - * Get metadata on Saved Views - * @param listId List ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2ListsListidSavedViews(listId, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param listId List ID - * @param viewId Saved view ID - */ - public getV2ListsListidSavedViewsViewidWithHttpInfo(listId: number, viewId: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidSavedViewsViewidWithHttpInfo(listId, viewId, _options); - return result.toPromise(); - } - - /** - * Returns metadata on a single Saved View. - * Get metadata on a single Saved View - * @param listId List ID - * @param viewId Saved view ID - */ - public getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Promise { - const result = this.api.getV2ListsListidSavedViewsViewid(listId, viewId, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param listId List ID - * @param viewId Saved view ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId, viewId, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all List Entries on a Saved View - * @param listId List ID - * @param viewId Saved view ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2ListsListidSavedViewsViewidListEntries(listId, viewId, cursor, limit, _options); - return result.toPromise(); - } - - -} - - - -import { ObservableOpportunitiesApi } from './ObservableAPI.ts'; - -import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; -export class PromiseOpportunitiesApi { - private api: ObservableOpportunitiesApi - - public constructor( - configuration: Configuration, - requestFactory?: OpportunitiesApiRequestFactory, - responseProcessor?: OpportunitiesApiResponseProcessor - ) { - this.api = new ObservableOpportunitiesApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Opportunity IDs - */ - public getV2OpportunitiesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise> { - const result = this.api.getV2OpportunitiesWithHttpInfo(cursor, limit, ids, _options); - return result.toPromise(); - } - - /** - * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get all Opportunities - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] Opportunity IDs - */ - public getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise { - const result = this.api.getV2Opportunities(cursor, limit, ids, _options); - return result.toPromise(); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param id Opportunity ID - */ - public getV2OpportunitiesIdWithHttpInfo(id: number, _options?: Configuration): Promise> { - const result = this.api.getV2OpportunitiesIdWithHttpInfo(id, _options); - return result.toPromise(); - } - - /** - * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a single Opportunity - * @param id Opportunity ID - */ - public getV2OpportunitiesId(id: number, _options?: Configuration): Promise { - const result = this.api.getV2OpportunitiesId(id, _options); - return result.toPromise(); - } - - -} - - - -import { ObservablePersonsApi } from './ObservableAPI.ts'; - -import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; -export class PromisePersonsApi { - private api: ObservablePersonsApi - - public constructor( - configuration: Configuration, - requestFactory?: PersonsApiRequestFactory, - responseProcessor?: PersonsApiResponseProcessor - ) { - this.api = new ObservablePersonsApi(configuration, requestFactory, responseProcessor); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] People IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { - const result = this.api.getV2PersonsWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get all Persons - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - * @param [ids] People IDs - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - const result = this.api.getV2Persons(cursor, limit, ids, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2PersonsFieldsWithHttpInfo(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. - * Get metadata on Person Fields - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2PersonsFields(cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param id Person ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { - const result = this.api.getV2PersonsIdWithHttpInfo(id, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). - * Get a single Person - * @param id Person ID - * @param [fieldIds] Field IDs for which to return field data - * @param [fieldTypes] Field Types for which to return field data - */ - public getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { - const result = this.api.getV2PersonsId(id, fieldIds, fieldTypes, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2PersonsIdListEntriesWithHttpInfo(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). - * Get a Person\'s List Entries - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2PersonsIdListEntries(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { - const result = this.api.getV2PersonsIdListsWithHttpInfo(id, cursor, limit, _options); - return result.toPromise(); - } - - /** - * Returns metadata for all the Lists on which the given Person appears. - * Get a Person\'s Lists - * @param id Persons ID - * @param [cursor] Cursor for the next or previous page - * @param [limit] Number of items to include in the page - */ - public getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { - const result = this.api.getV2PersonsIdLists(id, cursor, limit, _options); - return result.toPromise(); - } - - -} - - - diff --git a/src/v2/generated/util.ts b/src/v2/generated/util.ts deleted file mode 100644 index 96ea3df..0000000 --- a/src/v2/generated/util.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Returns if a specific http code is in a given code range - * where the code range is defined as a combination of digits - * and "X" (the letter X) with a length of 3 - * - * @param codeRange string with length 3 consisting of digits and "X" (the letter X) - * @param code the http status code to be checked against the code range - */ -export function isCodeInRange(codeRange: string, code: number): boolean { - // This is how the default value is encoded in OAG - if (codeRange === "0") { - return true; - } - if (codeRange == code.toString()) { - return true; - } else { - const codeString = code.toString(); - if (codeString.length != codeRange.length) { - return false; - } - for (let i = 0; i < codeString.length; i++) { - if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { - return false; - } - } - return true; - } -} - -/** -* Returns if it can consume form -* -* @param consumes array -*/ -export function canConsumeForm(contentTypes: string[]): boolean { - return contentTypes.indexOf('multipart/form-data') !== -1 -} From 59a6650a16c2c44655e4ca2609531cd522c36190 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 2 Oct 2024 17:43:33 +0100 Subject: [PATCH 2/5] Revert "chore: lock file" This reverts commit ee20b1251e677cafbf97562d84f93521d9ef58f6. --- deno.jsonc | 4 +- deno.lock | 950 ++++++++++++---- flake.nix | 2 +- src/v2/generated/.gitattributes | 8 + src/v2/generated/.gitignore | 1 + src/v2/generated/.openapi-generator-ignore | 23 + src/v2/generated/.openapi-generator/FILES | 107 ++ src/v2/generated/.openapi-generator/VERSION | 1 + src/v2/generated/AuthApi.md | 58 + src/v2/generated/CompaniesApi.md | 333 ++++++ src/v2/generated/ListsApi.md | 445 ++++++++ src/v2/generated/OpportunitiesApi.md | 130 +++ src/v2/generated/PersonsApi.md | 333 ++++++ src/v2/generated/apis/AuthApi.ts | 97 ++ src/v2/generated/apis/CompaniesApi.ts | 531 +++++++++ src/v2/generated/apis/ListsApi.ts | 702 ++++++++++++ src/v2/generated/apis/OpportunitiesApi.ts | 211 ++++ src/v2/generated/apis/PersonsApi.ts | 531 +++++++++ src/v2/generated/apis/baseapi.ts | 37 + src/v2/generated/apis/exception.ts | 15 + src/v2/generated/auth/auth.ts | 79 ++ src/v2/generated/configuration.ts | 82 ++ src/v2/generated/git_push.sh | 51 + src/v2/generated/http/http.ts | 244 ++++ src/v2/generated/http/isomorphic-fetch.ts | 30 + src/v2/generated/index.ts | 12 + src/v2/generated/middleware.ts | 66 ++ src/v2/generated/models/Attendee.ts | 47 + .../generated/models/AuthenticationError.ts | 49 + .../generated/models/AuthenticationErrors.ts | 43 + src/v2/generated/models/AuthorizationError.ts | 49 + .../generated/models/AuthorizationErrors.ts | 43 + src/v2/generated/models/ChatMessage.ts | 96 ++ src/v2/generated/models/CompaniesValue.ts | 55 + src/v2/generated/models/Company.ts | 93 ++ src/v2/generated/models/CompanyData.ts | 59 + src/v2/generated/models/CompanyListEntry.ts | 82 ++ src/v2/generated/models/CompanyPaged.ts | 51 + src/v2/generated/models/CompanyValue.ts | 52 + src/v2/generated/models/ConflictError.ts | 49 + src/v2/generated/models/DateValue.ts | 54 + src/v2/generated/models/Dropdown.ts | 49 + src/v2/generated/models/DropdownValue.ts | 52 + src/v2/generated/models/DropdownsValue.ts | 55 + src/v2/generated/models/Email.ts | 102 ++ .../generated/models/EmptyMessageBodyError.ts | 49 + src/v2/generated/models/Errors.ts | 39 + src/v2/generated/models/Field.ts | 89 ++ src/v2/generated/models/FieldMetadata.ts | 110 ++ src/v2/generated/models/FieldMetadataPaged.ts | 51 + src/v2/generated/models/FieldValue.ts | 79 ++ src/v2/generated/models/FloatValue.ts | 54 + src/v2/generated/models/FloatsValue.ts | 54 + src/v2/generated/models/FormulaNumber.ts | 39 + src/v2/generated/models/FormulaValue.ts | 52 + src/v2/generated/models/GenericError.ts | 49 + src/v2/generated/models/Grant.ts | 64 ++ src/v2/generated/models/Interaction.ts | 42 + src/v2/generated/models/InteractionValue.ts | 52 + .../models/InvalidAcceptHeaderError.ts | 49 + .../models/InvalidMessageBodyError.ts | 49 + .../models/InvalidVersionHeaderError.ts | 49 + src/v2/generated/models/List.ts | 79 ++ src/v2/generated/models/ListEntry.ts | 80 ++ src/v2/generated/models/ListEntryPaged.ts | 51 + .../generated/models/ListEntryWithEntity.ts | 39 + .../models/ListEntryWithEntityPaged.ts | 51 + src/v2/generated/models/ListPaged.ts | 51 + src/v2/generated/models/ListWithType.ts | 99 ++ src/v2/generated/models/ListWithTypePaged.ts | 51 + src/v2/generated/models/Location.ts | 79 ++ src/v2/generated/models/LocationValue.ts | 52 + src/v2/generated/models/LocationsValue.ts | 55 + src/v2/generated/models/Meeting.ts | 105 ++ .../generated/models/MethodNotAllowedError.ts | 49 + src/v2/generated/models/ModelError.ts | 72 ++ src/v2/generated/models/NotFoundError.ts | 49 + src/v2/generated/models/NotFoundErrors.ts | 43 + src/v2/generated/models/ObjectSerializer.ts | 574 ++++++++++ src/v2/generated/models/Opportunity.ts | 62 + .../generated/models/OpportunityListEntry.ts | 82 ++ src/v2/generated/models/OpportunityPaged.ts | 51 + .../generated/models/OpportunityWithFields.ts | 70 ++ src/v2/generated/models/Pagination.ts | 49 + src/v2/generated/models/Person.ts | 109 ++ src/v2/generated/models/PersonData.ts | 86 ++ src/v2/generated/models/PersonListEntry.ts | 82 ++ src/v2/generated/models/PersonPaged.ts | 51 + src/v2/generated/models/PersonValue.ts | 52 + src/v2/generated/models/PersonsValue.ts | 55 + src/v2/generated/models/PhoneCall.ts | 75 ++ src/v2/generated/models/RankedDropdown.ts | 69 ++ .../generated/models/RankedDropdownValue.ts | 52 + src/v2/generated/models/RateLimitError.ts | 49 + src/v2/generated/models/SavedView.ts | 79 ++ src/v2/generated/models/SavedViewPaged.ts | 51 + src/v2/generated/models/ServerError.ts | 49 + src/v2/generated/models/Tenant.ts | 59 + src/v2/generated/models/TextValue.ts | 55 + src/v2/generated/models/TextsValue.ts | 54 + .../models/TooManyMultipartFilesError.ts | 49 + src/v2/generated/models/User.ts | 69 ++ src/v2/generated/models/ValidationError.ts | 59 + src/v2/generated/models/ValidationErrors.ts | 43 + src/v2/generated/models/WhoAmI.ts | 56 + src/v2/generated/models/all.ts | 77 ++ src/v2/generated/rxjsStub.ts | 27 + src/v2/generated/servers.ts | 55 + src/v2/generated/types/ObjectParamAPI.ts | 1010 +++++++++++++++++ src/v2/generated/types/ObservableAPI.ts | 903 +++++++++++++++ src/v2/generated/types/PromiseAPI.ts | 647 +++++++++++ src/v2/generated/util.ts | 37 + 112 files changed, 12882 insertions(+), 203 deletions(-) create mode 100644 src/v2/generated/.gitattributes create mode 100644 src/v2/generated/.gitignore create mode 100644 src/v2/generated/.openapi-generator-ignore create mode 100644 src/v2/generated/.openapi-generator/FILES create mode 100644 src/v2/generated/.openapi-generator/VERSION create mode 100644 src/v2/generated/AuthApi.md create mode 100644 src/v2/generated/CompaniesApi.md create mode 100644 src/v2/generated/ListsApi.md create mode 100644 src/v2/generated/OpportunitiesApi.md create mode 100644 src/v2/generated/PersonsApi.md create mode 100644 src/v2/generated/apis/AuthApi.ts create mode 100644 src/v2/generated/apis/CompaniesApi.ts create mode 100644 src/v2/generated/apis/ListsApi.ts create mode 100644 src/v2/generated/apis/OpportunitiesApi.ts create mode 100644 src/v2/generated/apis/PersonsApi.ts create mode 100644 src/v2/generated/apis/baseapi.ts create mode 100644 src/v2/generated/apis/exception.ts create mode 100644 src/v2/generated/auth/auth.ts create mode 100644 src/v2/generated/configuration.ts create mode 100644 src/v2/generated/git_push.sh create mode 100644 src/v2/generated/http/http.ts create mode 100644 src/v2/generated/http/isomorphic-fetch.ts create mode 100644 src/v2/generated/index.ts create mode 100644 src/v2/generated/middleware.ts create mode 100644 src/v2/generated/models/Attendee.ts create mode 100644 src/v2/generated/models/AuthenticationError.ts create mode 100644 src/v2/generated/models/AuthenticationErrors.ts create mode 100644 src/v2/generated/models/AuthorizationError.ts create mode 100644 src/v2/generated/models/AuthorizationErrors.ts create mode 100644 src/v2/generated/models/ChatMessage.ts create mode 100644 src/v2/generated/models/CompaniesValue.ts create mode 100644 src/v2/generated/models/Company.ts create mode 100644 src/v2/generated/models/CompanyData.ts create mode 100644 src/v2/generated/models/CompanyListEntry.ts create mode 100644 src/v2/generated/models/CompanyPaged.ts create mode 100644 src/v2/generated/models/CompanyValue.ts create mode 100644 src/v2/generated/models/ConflictError.ts create mode 100644 src/v2/generated/models/DateValue.ts create mode 100644 src/v2/generated/models/Dropdown.ts create mode 100644 src/v2/generated/models/DropdownValue.ts create mode 100644 src/v2/generated/models/DropdownsValue.ts create mode 100644 src/v2/generated/models/Email.ts create mode 100644 src/v2/generated/models/EmptyMessageBodyError.ts create mode 100644 src/v2/generated/models/Errors.ts create mode 100644 src/v2/generated/models/Field.ts create mode 100644 src/v2/generated/models/FieldMetadata.ts create mode 100644 src/v2/generated/models/FieldMetadataPaged.ts create mode 100644 src/v2/generated/models/FieldValue.ts create mode 100644 src/v2/generated/models/FloatValue.ts create mode 100644 src/v2/generated/models/FloatsValue.ts create mode 100644 src/v2/generated/models/FormulaNumber.ts create mode 100644 src/v2/generated/models/FormulaValue.ts create mode 100644 src/v2/generated/models/GenericError.ts create mode 100644 src/v2/generated/models/Grant.ts create mode 100644 src/v2/generated/models/Interaction.ts create mode 100644 src/v2/generated/models/InteractionValue.ts create mode 100644 src/v2/generated/models/InvalidAcceptHeaderError.ts create mode 100644 src/v2/generated/models/InvalidMessageBodyError.ts create mode 100644 src/v2/generated/models/InvalidVersionHeaderError.ts create mode 100644 src/v2/generated/models/List.ts create mode 100644 src/v2/generated/models/ListEntry.ts create mode 100644 src/v2/generated/models/ListEntryPaged.ts create mode 100644 src/v2/generated/models/ListEntryWithEntity.ts create mode 100644 src/v2/generated/models/ListEntryWithEntityPaged.ts create mode 100644 src/v2/generated/models/ListPaged.ts create mode 100644 src/v2/generated/models/ListWithType.ts create mode 100644 src/v2/generated/models/ListWithTypePaged.ts create mode 100644 src/v2/generated/models/Location.ts create mode 100644 src/v2/generated/models/LocationValue.ts create mode 100644 src/v2/generated/models/LocationsValue.ts create mode 100644 src/v2/generated/models/Meeting.ts create mode 100644 src/v2/generated/models/MethodNotAllowedError.ts create mode 100644 src/v2/generated/models/ModelError.ts create mode 100644 src/v2/generated/models/NotFoundError.ts create mode 100644 src/v2/generated/models/NotFoundErrors.ts create mode 100644 src/v2/generated/models/ObjectSerializer.ts create mode 100644 src/v2/generated/models/Opportunity.ts create mode 100644 src/v2/generated/models/OpportunityListEntry.ts create mode 100644 src/v2/generated/models/OpportunityPaged.ts create mode 100644 src/v2/generated/models/OpportunityWithFields.ts create mode 100644 src/v2/generated/models/Pagination.ts create mode 100644 src/v2/generated/models/Person.ts create mode 100644 src/v2/generated/models/PersonData.ts create mode 100644 src/v2/generated/models/PersonListEntry.ts create mode 100644 src/v2/generated/models/PersonPaged.ts create mode 100644 src/v2/generated/models/PersonValue.ts create mode 100644 src/v2/generated/models/PersonsValue.ts create mode 100644 src/v2/generated/models/PhoneCall.ts create mode 100644 src/v2/generated/models/RankedDropdown.ts create mode 100644 src/v2/generated/models/RankedDropdownValue.ts create mode 100644 src/v2/generated/models/RateLimitError.ts create mode 100644 src/v2/generated/models/SavedView.ts create mode 100644 src/v2/generated/models/SavedViewPaged.ts create mode 100644 src/v2/generated/models/ServerError.ts create mode 100644 src/v2/generated/models/Tenant.ts create mode 100644 src/v2/generated/models/TextValue.ts create mode 100644 src/v2/generated/models/TextsValue.ts create mode 100644 src/v2/generated/models/TooManyMultipartFilesError.ts create mode 100644 src/v2/generated/models/User.ts create mode 100644 src/v2/generated/models/ValidationError.ts create mode 100644 src/v2/generated/models/ValidationErrors.ts create mode 100644 src/v2/generated/models/WhoAmI.ts create mode 100644 src/v2/generated/models/all.ts create mode 100644 src/v2/generated/rxjsStub.ts create mode 100644 src/v2/generated/servers.ts create mode 100644 src/v2/generated/types/ObjectParamAPI.ts create mode 100644 src/v2/generated/types/ObservableAPI.ts create mode 100644 src/v2/generated/types/PromiseAPI.ts create mode 100644 src/v2/generated/util.ts diff --git a/deno.jsonc b/deno.jsonc index ab56ccc..8dece39 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.3", + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", "@std/assert": "jsr:@std/assert@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.0", "@std/jsonc": "jsr:@std/jsonc@^1.0.0", @@ -24,7 +24,7 @@ "snapshot-update": "deno task test --allow-write=./src/v1/tests/__snapshots__,./src/v2/tests/__snapshots__ -- --update", "format": "deno fmt && nixpkgs-fmt *.nix && yamllint . && yamlfmt .", "lint": "deno lint", - "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.7", + "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.6", "generate-v2-client": "rm -rf src/v2/generated && openapi-generator-cli generate", "update-deno-lock": "deno cache --lock-write src/index.ts", "update-flake-lock": "nix --option commit-lockfile-summary 'chore: update flake.lock' flake update --commit-lock-file", diff --git a/deno.lock b/deno.lock index 038b856..dec0f0e 100644 --- a/deno.lock +++ b/deno.lock @@ -4,40 +4,50 @@ "specifiers": { "jsr:@david/code-block-writer@^13.0.2": "jsr:@david/code-block-writer@13.0.2", "jsr:@deno/cache-dir@^0.10.3": "jsr:@deno/cache-dir@0.10.3", - "jsr:@deno/dnt@^0.41.3": "jsr:@deno/dnt@0.41.3", + "jsr:@deno/dnt@^0.41.2": "jsr:@deno/dnt@0.41.3", + "jsr:@deno/graph@^0.73.1": "jsr:@deno/graph@0.73.1", "jsr:@std/assert@^0.223.0": "jsr:@std/assert@0.223.0", "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", - "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.6", - "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.6", + "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.2", + "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.2", + "jsr:@std/async@^1.0.2": "jsr:@std/async@1.0.3", "jsr:@std/bytes@^0.223.0": "jsr:@std/bytes@0.223.0", - "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.2", + "jsr:@std/bytes@^1.0.2-rc.3": "jsr:@std/bytes@1.0.2", + "jsr:@std/data-structures@^1.0.1": "jsr:@std/data-structures@1.0.1", + "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.0", "jsr:@std/fmt@^0.223": "jsr:@std/fmt@0.223.0", - "jsr:@std/fs@1": "jsr:@std/fs@1.0.4", + "jsr:@std/fmt@^0.223.0": "jsr:@std/fmt@0.223.0", + "jsr:@std/fmt@^0.225.3": "jsr:@std/fmt@0.225.3", + "jsr:@std/fs@1": "jsr:@std/fs@1.0.1", "jsr:@std/fs@^0.223": "jsr:@std/fs@0.223.0", "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", - "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.4", - "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.4", - "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.4", - "jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4", + "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.1", + "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.1", + "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.1", + "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.1", "jsr:@std/io": "jsr:@std/io@0.223.0", "jsr:@std/io@^0.223": "jsr:@std/io@0.223.0", - "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.1", - "jsr:@std/path@1": "jsr:@std/path@1.0.6", + "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.0", + "jsr:@std/path@1": "jsr:@std/path@1.0.2", "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", "jsr:@std/path@^0.223": "jsr:@std/path@0.223.0", + "jsr:@std/path@^0.223.0": "jsr:@std/path@0.223.0", "jsr:@std/path@^0.225.2": "jsr:@std/path@0.225.2", - "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.6", - "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.6", - "jsr:@std/path@^1.0.6": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.2", + "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.2", + "jsr:@std/streams@^1.0.0": "jsr:@std/streams@1.0.1", "jsr:@std/testing@^1.0.0": "jsr:@std/testing@1.0.0", "jsr:@ts-morph/bootstrap@^0.24.0": "jsr:@ts-morph/bootstrap@0.24.0", "jsr:@ts-morph/common@^0.24.0": "jsr:@ts-morph/common@0.24.0", + "npm:@openapitools/openapi-generator-cli@2.13.4": "npm:@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", + "npm:@openapitools/openapi-generator-cli@2.13.5": "npm:@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", "npm:@types/node": "npm:@types/node@18.16.19", - "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.7", - "npm:axios@^1.7.3": "npm:axios@1.7.7", + "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.4", + "npm:axios@^1.7.3": "npm:axios@1.7.4", "npm:fetch-blob@^4.0.0": "npm:fetch-blob@4.0.0", "npm:fetch-mock@^11.1.3": "npm:fetch-mock@11.1.3", - "npm:typedoc@0.26.7": "npm:typedoc@0.26.7_typescript@5.5.4", + "npm:typedoc@0.25.13": "npm:typedoc@0.25.13_typescript@5.4.5", + "npm:typedoc@0.26.6": "npm:typedoc@0.26.6_typescript@5.5.4", "npm:typescript@^5.4.5": "npm:typescript@5.5.4" }, "jsr": { @@ -47,6 +57,7 @@ "@deno/cache-dir@0.10.3": { "integrity": "eb022f84ecc49c91d9d98131c6e6b118ff63a29e343624d058646b9d50404776", "dependencies": [ + "jsr:@deno/graph@^0.73.1", "jsr:@std/fmt@^0.223", "jsr:@std/fs@^0.223", "jsr:@std/io@^0.223", @@ -64,11 +75,20 @@ "jsr:@ts-morph/bootstrap@^0.24.0" ] }, + "@deno/graph@0.73.1": { + "integrity": "cd69639d2709d479037d5ce191a422eabe8d71bb68b0098344f6b07411c84d41" + }, "@std/assert@0.223.0": { - "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24" + "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24", + "dependencies": [ + "jsr:@std/fmt@^0.223.0" + ] }, "@std/assert@0.226.0": { - "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3" + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3", + "dependencies": [ + "jsr:@std/internal@^1.0.0" + ] }, "@std/assert@1.0.2": { "integrity": "ccacec332958126deaceb5c63ff8b4eaf9f5ed0eac9feccf124110435e59e49c", @@ -76,23 +96,33 @@ "jsr:@std/internal@^1.0.1" ] }, - "@std/assert@1.0.6": { - "integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207", - "dependencies": [ - "jsr:@std/internal@^1.0.4" - ] + "@std/async@1.0.3": { + "integrity": "6ed64678db43451683c6c176a21426a2ccd21ba0269ebb2c36133ede3f165792" }, "@std/bytes@0.223.0": { "integrity": "84b75052cd8680942c397c2631318772b295019098f40aac5c36cead4cba51a8" }, + "@std/bytes@1.0.2": { + "integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57" + }, + "@std/data-structures@1.0.1": { + "integrity": "e4fa6bcc33839979ac118e2746f349cd7b57c58bd3036b5b82ac608771ee856e" + }, "@std/fmt@0.223.0": { "integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208" }, - "@std/fmt@1.0.2": { - "integrity": "87e9dfcdd3ca7c066e0c3c657c1f987c82888eb8103a3a3baa62684ffeb0f7a7" + "@std/fmt@0.225.3": { + "integrity": "cb6ea567155f9865b80b502b2dde7671803eddd6dad743d8851d0de2c40bd349" + }, + "@std/fmt@1.0.0": { + "integrity": "8a95c9fdbb61559418ccbc0f536080cf43341655e1444f9d375a66886ceaaa3d" }, "@std/fs@0.223.0": { - "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c" + "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c", + "dependencies": [ + "jsr:@std/assert@^0.223.0", + "jsr:@std/path@^0.223.0" + ] }, "@std/fs@0.229.3": { "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", @@ -100,18 +130,18 @@ "jsr:@std/path@1.0.0-rc.1" ] }, - "@std/fs@1.0.4": { - "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", + "@std/fs@1.0.1": { + "integrity": "d6914ca2c21abe591f733b31dbe6331e446815e513e2451b3b9e472daddfefcb", "dependencies": [ - "jsr:@std/path@^1.0.6" + "jsr:@std/path@^1.0.2" ] }, + "@std/internal@1.0.0": { + "integrity": "ac6a6dfebf838582c4b4f61a6907374e27e05bedb6ce276e0f1608fe84e7cd9a" + }, "@std/internal@1.0.1": { "integrity": "6f8c7544d06a11dd256c8d6ba54b11ed870aac6c5aeafff499892662c57673e6" }, - "@std/internal@1.0.4": { - "integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422" - }, "@std/io@0.223.0": { "integrity": "2d8c3c2ab3a515619b90da2c6ff5ea7b75a94383259ef4d02116b228393f84f1", "dependencies": [ @@ -119,8 +149,8 @@ "jsr:@std/bytes@^0.223.0" ] }, - "@std/jsonc@1.0.1": { - "integrity": "6b36956e2a7cbb08ca5ad7fbec72e661e6217c202f348496ea88747636710dda" + "@std/jsonc@1.0.0": { + "integrity": "835da212e586f3ef94ab25e8f0e8a7711a86fddbee95ad40c34d6b3d74da1a1b" }, "@std/path@0.223.0": { "integrity": "593963402d7e6597f5a6e620931661053572c982fc014000459edc1f93cc3989", @@ -137,13 +167,31 @@ "@std/path@1.0.0-rc.1": { "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" }, - "@std/path@1.0.6": { - "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" + "@std/path@1.0.2": { + "integrity": "a452174603f8c620bd278a380c596437a9eef50c891c64b85812f735245d9ec7" + }, + "@std/streams@1.0.1": { + "integrity": "b07008b83fd7ae08965920d0fd700e07caf233bdd81e0ef1c8cca6c4140da364", + "dependencies": [ + "jsr:@std/bytes@^1.0.2-rc.3" + ] + }, + "@std/testing@0.225.0": { + "integrity": "53ca3c47eb121acabda633fd50699c4b33da6a7ce3e5bb34d7277d15df5f0a6e", + "dependencies": [ + "jsr:@std/assert@^0.226.0", + "jsr:@std/fmt@^0.225.3", + "jsr:@std/fs@^0.229.1", + "jsr:@std/internal@^1.0.0", + "jsr:@std/path@^0.225.2" + ] }, "@std/testing@1.0.0": { "integrity": "27cfc06392c69c2acffe54e6d0bcb5f961cf193f519255372bd4fff1481bfef8", "dependencies": [ "jsr:@std/assert@^1.0.2", + "jsr:@std/async@^1.0.2", + "jsr:@std/data-structures@^1.0.1", "jsr:@std/fs@^1.0.1", "jsr:@std/internal@^1.0.1", "jsr:@std/path@^1.0.2" @@ -164,41 +212,119 @@ } }, "npm": { - "@shikijs/core@1.21.0": { - "integrity": "sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==", + "@babel/runtime@7.24.6": { + "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "dependencies": { + "regenerator-runtime": "regenerator-runtime@0.14.1" + } + }, + "@lukeed/csprng@1.1.0": { + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", + "dependencies": {} + }, + "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", + "dependencies": { + "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "axios": "axios@1.6.8", + "rxjs": "rxjs@7.8.1" + } + }, + "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", + "dependencies": { + "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "axios": "axios@1.7.4", + "rxjs": "rxjs@7.8.1" + } + }, + "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1": { + "integrity": "sha512-DGv34UHsZBxCM3H5QGE2XE/+oLJzz5+714JQjBhjD9VccFlQs3LRxo/epso4l7nJIiNlZkPyIUC8WzfU/5RTsQ==", + "dependencies": { + "iterare": "iterare@1.2.1", + "reflect-metadata": "reflect-metadata@0.1.13", + "rxjs": "rxjs@7.8.1", + "tslib": "tslib@2.6.2", + "uid": "uid@2.0.2" + } + }, + "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1": { + "integrity": "sha512-N06P5ncknW/Pm8bj964WvLIZn2gNhHliCBoAO1LeBvNImYkecqKcrmLbY49Fa1rmMfEM3MuBHeDys3edeuYAOA==", + "dependencies": { + "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", + "fast-safe-stringify": "fast-safe-stringify@2.1.1", + "iterare": "iterare@1.2.1", + "path-to-regexp": "path-to-regexp@3.2.0", + "reflect-metadata": "reflect-metadata@0.1.13", + "rxjs": "rxjs@7.8.1", + "tslib": "tslib@2.6.2", + "uid": "uid@2.0.2" + } + }, + "@nuxtjs/opencollective@0.3.2": { + "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", "dependencies": { - "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", - "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "@types/hast": "@types/hast@3.0.4", - "hast-util-to-html": "hast-util-to-html@9.0.3" + "chalk": "chalk@4.1.2", + "consola": "consola@2.15.3", + "node-fetch": "node-fetch@2.7.0" } }, - "@shikijs/engine-javascript@1.21.0": { - "integrity": "sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==", + "@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-4JKyrk55ohQK2FcuZbPdNvxdyXD14jjOIvE8hYjJ+E1cHbRbfXQXbYnjTODFE52Gx8eAxz8C9icuhDYDLn7nww==", "dependencies": { - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "oniguruma-to-js": "oniguruma-to-js@0.4.3" + "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", + "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", + "axios": "axios@1.6.8", + "chalk": "chalk@4.1.2", + "commander": "commander@8.3.0", + "compare-versions": "compare-versions@4.1.4", + "concurrently": "concurrently@6.5.1", + "console.table": "console.table@0.10.0", + "fs-extra": "fs-extra@10.1.0", + "glob": "glob@7.2.3", + "https-proxy-agent": "https-proxy-agent@7.0.4", + "inquirer": "inquirer@8.2.6", + "lodash": "lodash@4.17.21", + "reflect-metadata": "reflect-metadata@0.1.13", + "rxjs": "rxjs@7.8.1", + "tslib": "tslib@2.6.2" } }, - "@shikijs/engine-oniguruma@1.21.0": { - "integrity": "sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==", + "@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-9VgeKOTiiatKSwZDKKB3C86cW8tN9eDcFohotD4eisdK38UQswk/4Ysoq9KChRCbymjoMp6AIDHPtK1DQ2fTgw==", "dependencies": { - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2" + "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", + "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", + "axios": "axios@1.7.4", + "chalk": "chalk@4.1.2", + "commander": "commander@8.3.0", + "compare-versions": "compare-versions@4.1.4", + "concurrently": "concurrently@6.5.1", + "console.table": "console.table@0.10.0", + "fs-extra": "fs-extra@10.1.0", + "glob": "glob@7.2.3", + "https-proxy-agent": "https-proxy-agent@7.0.4", + "inquirer": "inquirer@8.2.6", + "lodash": "lodash@4.17.21", + "reflect-metadata": "reflect-metadata@0.1.13", + "rxjs": "rxjs@7.8.1", + "tslib": "tslib@2.6.2" } }, - "@shikijs/types@1.21.0": { - "integrity": "sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==", + "@shikijs/core@1.16.1": { + "integrity": "sha512-aI0hBtw+a6KsJp2jcD4YuQqKpeCbURMZbhHVozDknJpm+KJqeMRkEnfBC8BaKE/5XC+uofPgCLsa/TkTk0Ba0w==", "dependencies": { - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", "@types/hast": "@types/hast@3.0.4" } }, - "@shikijs/vscode-textmate@9.2.2": { - "integrity": "sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==", + "@shikijs/vscode-textmate@9.2.0": { + "integrity": "sha512-5FinaOp6Vdh/dl4/yaOTh0ZeKch+rYS8DUb38V3GMKYVkdqzxw53lViRKUYkVILRiVQT7dcPC7VvAKOR73zVtQ==", "dependencies": {} }, "@types/glob-to-regexp@0.4.4": { @@ -211,12 +337,6 @@ "@types/unist": "@types/unist@3.0.3" } }, - "@types/mdast@4.0.4": { - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, "@types/node@18.16.19": { "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "dependencies": {} @@ -225,10 +345,32 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "dependencies": {} }, - "@ungap/structured-clone@1.2.0": { - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "agent-base@7.1.1": { + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dependencies": { + "debug": "debug@4.3.5" + } + }, + "ansi-escapes@4.3.2": { + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dependencies": { + "type-fest": "type-fest@0.21.3" + } + }, + "ansi-regex@5.0.1": { + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dependencies": {} + }, + "ansi-sequence-parser@1.1.1": { + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", "dependencies": {} }, + "ansi-styles@4.3.0": { + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "color-convert@2.0.1" + } + }, "argparse@2.0.1": { "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dependencies": {} @@ -237,18 +379,26 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dependencies": {} }, - "axios-mock-adapter@2.0.0_axios@1.7.7": { + "axios-mock-adapter@2.0.0_axios@1.7.4": { "integrity": "sha512-D/K0J5Zm6KvaMTnsWrBQZWLzKN9GxUFZEa0mx2qeEHXDeTugCoplWehy8y36dj5vuSjhe1u/Dol8cZ8lzzmDew==", "dependencies": { - "axios": "axios@1.7.7", + "axios": "axios@1.7.4", "fast-deep-equal": "fast-deep-equal@3.1.3", "is-buffer": "is-buffer@2.0.5" } }, - "axios@1.7.7": { - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "axios@1.6.8": { + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "follow-redirects@1.15.8", + "follow-redirects": "follow-redirects@1.15.6", + "form-data": "form-data@4.0.0", + "proxy-from-env": "proxy-from-env@1.1.0" + } + }, + "axios@1.7.4": { + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "dependencies": { + "follow-redirects": "follow-redirects@1.15.6", "form-data": "form-data@4.0.0", "proxy-from-env": "proxy-from-env@1.1.0" } @@ -257,22 +407,83 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dependencies": {} }, + "base64-js@1.5.1": { + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dependencies": {} + }, + "bl@4.1.0": { + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "buffer@5.7.1", + "inherits": "inherits@2.0.4", + "readable-stream": "readable-stream@3.6.2" + } + }, + "brace-expansion@1.1.11": { + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "balanced-match@1.0.2", + "concat-map": "concat-map@0.0.1" + } + }, "brace-expansion@2.0.1": { "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dependencies": { "balanced-match": "balanced-match@1.0.2" } }, - "ccount@2.0.1": { - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "buffer@5.7.1": { + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dependencies": { + "base64-js": "base64-js@1.5.1", + "ieee754": "ieee754@1.2.1" + } + }, + "chalk@4.1.2": { + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "ansi-styles@4.3.0", + "supports-color": "supports-color@7.2.0" + } + }, + "chardet@0.7.0": { + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dependencies": {} + }, + "cli-cursor@3.1.0": { + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "restore-cursor@3.1.0" + } + }, + "cli-spinners@2.9.2": { + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dependencies": {} }, - "character-entities-html4@2.1.0": { - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "cli-width@3.0.0": { + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", "dependencies": {} }, - "character-entities-legacy@3.0.0": { - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "cliui@7.0.4": { + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "string-width@4.2.3", + "strip-ansi": "strip-ansi@6.0.1", + "wrap-ansi": "wrap-ansi@7.0.0" + } + }, + "clone@1.0.4": { + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dependencies": {} + }, + "color-convert@2.0.1": { + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "color-name@1.1.4" + } + }, + "color-name@1.1.4": { + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dependencies": {} }, "combined-stream@1.0.8": { @@ -281,10 +492,59 @@ "delayed-stream": "delayed-stream@1.0.0" } }, - "comma-separated-tokens@2.0.3": { - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "commander@8.3.0": { + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", "dependencies": {} }, + "compare-versions@4.1.4": { + "integrity": "sha512-FemMreK9xNyL8gQevsdRMrvO4lFCkQP7qbuktn1q8ndcNk1+0mz7lgE7b/sNvbhVgY4w6tMN1FDp6aADjqw2rw==", + "dependencies": {} + }, + "concat-map@0.0.1": { + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dependencies": {} + }, + "concurrently@6.5.1": { + "integrity": "sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==", + "dependencies": { + "chalk": "chalk@4.1.2", + "date-fns": "date-fns@2.30.0", + "lodash": "lodash@4.17.21", + "rxjs": "rxjs@6.6.7", + "spawn-command": "spawn-command@0.0.2-1", + "supports-color": "supports-color@8.1.1", + "tree-kill": "tree-kill@1.2.2", + "yargs": "yargs@16.2.0" + } + }, + "consola@2.15.3": { + "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==", + "dependencies": {} + }, + "console.table@0.10.0": { + "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", + "dependencies": { + "easy-table": "easy-table@1.1.0" + } + }, + "date-fns@2.30.0": { + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dependencies": { + "@babel/runtime": "@babel/runtime@7.24.6" + } + }, + "debug@4.3.5": { + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dependencies": { + "ms": "ms@2.1.2" + } + }, + "defaults@1.0.4": { + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dependencies": { + "clone": "clone@1.0.4" + } + }, "delayed-stream@1.0.0": { "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dependencies": {} @@ -293,20 +553,44 @@ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dependencies": {} }, - "devlop@1.1.0": { - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "easy-table@1.1.0": { + "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", "dependencies": { - "dequal": "dequal@2.0.3" + "wcwidth": "wcwidth@1.0.1" } }, + "emoji-regex@8.0.0": { + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dependencies": {} + }, "entities@4.5.0": { "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dependencies": {} }, + "escalade@3.1.2": { + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "dependencies": {} + }, + "escape-string-regexp@1.0.5": { + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dependencies": {} + }, + "external-editor@3.1.0": { + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dependencies": { + "chardet": "chardet@0.7.0", + "iconv-lite": "iconv-lite@0.4.24", + "tmp": "tmp@0.0.33" + } + }, "fast-deep-equal@3.1.3": { "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dependencies": {} }, + "fast-safe-stringify@2.1.1": { + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dependencies": {} + }, "fetch-blob@4.0.0": { "integrity": "sha512-nPmnhRmpNMjYWnp9EBMGs6z5lq9RXed5W1vuZcECrsDVQInM8AMQSooVb3X183Aole60adzjWbH9qlRFWzDDTA==", "dependencies": { @@ -323,8 +607,14 @@ "regexparam": "regexparam@3.0.0" } }, - "follow-redirects@1.15.8": { - "integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==", + "figures@3.2.0": { + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dependencies": { + "escape-string-regexp": "escape-string-regexp@1.0.5" + } + }, + "follow-redirects@1.15.6": { + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dependencies": {} }, "form-data@4.0.0": { @@ -335,50 +625,145 @@ "mime-types": "mime-types@2.1.35" } }, + "fs-extra@10.1.0": { + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "graceful-fs@4.2.11", + "jsonfile": "jsonfile@6.1.0", + "universalify": "universalify@2.0.1" + } + }, + "fs.realpath@1.0.0": { + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dependencies": {} + }, + "get-caller-file@2.0.5": { + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dependencies": {} + }, "glob-to-regexp@0.4.1": { "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dependencies": {} }, - "hast-util-to-html@9.0.3": { - "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", + "glob@7.2.3": { + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { - "@types/hast": "@types/hast@3.0.4", - "@types/unist": "@types/unist@3.0.3", - "ccount": "ccount@2.0.1", - "comma-separated-tokens": "comma-separated-tokens@2.0.3", - "hast-util-whitespace": "hast-util-whitespace@3.0.0", - "html-void-elements": "html-void-elements@3.0.0", - "mdast-util-to-hast": "mdast-util-to-hast@13.2.0", - "property-information": "property-information@6.5.0", - "space-separated-tokens": "space-separated-tokens@2.0.2", - "stringify-entities": "stringify-entities@4.0.4", - "zwitch": "zwitch@2.0.4" + "fs.realpath": "fs.realpath@1.0.0", + "inflight": "inflight@1.0.6", + "inherits": "inherits@2.0.4", + "minimatch": "minimatch@3.1.2", + "once": "once@1.4.0", + "path-is-absolute": "path-is-absolute@1.0.1" } }, - "hast-util-whitespace@3.0.0": { - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "graceful-fs@4.2.11": { + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dependencies": {} + }, + "has-flag@4.0.0": { + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dependencies": {} + }, + "https-proxy-agent@7.0.4": { + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dependencies": { - "@types/hast": "@types/hast@3.0.4" + "agent-base": "agent-base@7.1.1", + "debug": "debug@4.3.5" + } + }, + "iconv-lite@0.4.24": { + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": "safer-buffer@2.1.2" } }, - "html-void-elements@3.0.0": { - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "ieee754@1.2.1": { + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dependencies": {} }, + "inflight@1.0.6": { + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "once@1.4.0", + "wrappy": "wrappy@1.0.2" + } + }, + "inherits@2.0.4": { + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dependencies": {} + }, + "inquirer@8.2.6": { + "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==", + "dependencies": { + "ansi-escapes": "ansi-escapes@4.3.2", + "chalk": "chalk@4.1.2", + "cli-cursor": "cli-cursor@3.1.0", + "cli-width": "cli-width@3.0.0", + "external-editor": "external-editor@3.1.0", + "figures": "figures@3.2.0", + "lodash": "lodash@4.17.21", + "mute-stream": "mute-stream@0.0.8", + "ora": "ora@5.4.1", + "run-async": "run-async@2.4.1", + "rxjs": "rxjs@7.8.1", + "string-width": "string-width@4.2.3", + "strip-ansi": "strip-ansi@6.0.1", + "through": "through@2.3.8", + "wrap-ansi": "wrap-ansi@6.2.0" + } + }, "is-buffer@2.0.5": { "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "dependencies": {} }, + "is-fullwidth-code-point@3.0.0": { + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dependencies": {} + }, + "is-interactive@1.0.0": { + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dependencies": {} + }, "is-subset@0.1.1": { "integrity": "sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw==", "dependencies": {} }, + "is-unicode-supported@0.1.0": { + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dependencies": {} + }, + "iterare@1.2.1": { + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", + "dependencies": {} + }, + "jsonc-parser@3.2.1": { + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", + "dependencies": {} + }, + "jsonfile@6.1.0": { + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "graceful-fs": "graceful-fs@4.2.11", + "universalify": "universalify@2.0.1" + } + }, "linkify-it@5.0.0": { "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dependencies": { "uc.micro": "uc.micro@2.1.0" } }, + "lodash@4.17.21": { + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dependencies": {} + }, + "log-symbols@4.1.0": { + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "chalk@4.1.2", + "is-unicode-supported": "is-unicode-supported@0.1.0" + } + }, "lunr@2.3.9": { "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dependencies": {} @@ -394,79 +779,94 @@ "uc.micro": "uc.micro@2.1.0" } }, - "mdast-util-to-hast@13.2.0": { - "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", - "dependencies": { - "@types/hast": "@types/hast@3.0.4", - "@types/mdast": "@types/mdast@4.0.4", - "@ungap/structured-clone": "@ungap/structured-clone@1.2.0", - "devlop": "devlop@1.1.0", - "micromark-util-sanitize-uri": "micromark-util-sanitize-uri@2.0.0", - "trim-lines": "trim-lines@3.0.1", - "unist-util-position": "unist-util-position@5.0.0", - "unist-util-visit": "unist-util-visit@5.0.0", - "vfile": "vfile@6.0.3" - } + "marked@4.3.0": { + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dependencies": {} }, "mdurl@2.0.0": { "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dependencies": {} }, - "micromark-util-character@2.1.0": { - "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dependencies": {} + }, + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "micromark-util-symbol": "micromark-util-symbol@2.0.0", - "micromark-util-types": "micromark-util-types@2.0.0" + "mime-db": "mime-db@1.52.0" } }, - "micromark-util-encode@2.0.0": { - "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "mimic-fn@2.1.0": { + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dependencies": {} }, - "micromark-util-sanitize-uri@2.0.0": { - "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "minimatch@3.1.2": { + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "brace-expansion@1.1.11" + } + }, + "minimatch@9.0.5": { + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dependencies": { - "micromark-util-character": "micromark-util-character@2.1.0", - "micromark-util-encode": "micromark-util-encode@2.0.0", - "micromark-util-symbol": "micromark-util-symbol@2.0.0" + "brace-expansion": "brace-expansion@2.0.1" } }, - "micromark-util-symbol@2.0.0": { - "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "ms@2.1.2": { + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dependencies": {} }, - "micromark-util-types@2.0.0": { - "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "mute-stream@0.0.8": { + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dependencies": {} }, - "mime-db@1.52.0": { - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "node-domexception@1.0.0": { + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", "dependencies": {} }, - "mime-types@2.1.35": { - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node-fetch@2.7.0": { + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { - "mime-db": "mime-db@1.52.0" + "whatwg-url": "whatwg-url@5.0.0" } }, - "minimatch@9.0.5": { - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "once@1.4.0": { + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dependencies": { - "brace-expansion": "brace-expansion@2.0.1" + "wrappy": "wrappy@1.0.2" } }, - "node-domexception@1.0.0": { - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "dependencies": {} + "onetime@5.1.2": { + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "mimic-fn@2.1.0" + } }, - "oniguruma-to-js@0.4.3": { - "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", + "ora@5.4.1": { + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dependencies": { - "regex": "regex@4.3.3" + "bl": "bl@4.1.0", + "chalk": "chalk@4.1.2", + "cli-cursor": "cli-cursor@3.1.0", + "cli-spinners": "cli-spinners@2.9.2", + "is-interactive": "is-interactive@1.0.0", + "is-unicode-supported": "is-unicode-supported@0.1.0", + "log-symbols": "log-symbols@4.1.0", + "strip-ansi": "strip-ansi@6.0.1", + "wcwidth": "wcwidth@1.0.1" } }, - "property-information@6.5.0": { - "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "os-tmpdir@1.0.2": { + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dependencies": {} + }, + "path-is-absolute@1.0.1": { + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dependencies": {} + }, + "path-to-regexp@3.2.0": { + "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==", "dependencies": {} }, "proxy-from-env@1.1.0": { @@ -477,51 +877,173 @@ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", "dependencies": {} }, - "regex@4.3.3": { - "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", + "readable-stream@3.6.2": { + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "inherits@2.0.4", + "string_decoder": "string_decoder@1.3.0", + "util-deprecate": "util-deprecate@1.0.2" + } + }, + "reflect-metadata@0.1.13": { + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", + "dependencies": {} + }, + "regenerator-runtime@0.14.1": { + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "dependencies": {} }, "regexparam@3.0.0": { "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", "dependencies": {} }, - "shiki@1.21.0": { - "integrity": "sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==", + "require-directory@2.1.1": { + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dependencies": {} + }, + "restore-cursor@3.1.0": { + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "onetime@5.1.2", + "signal-exit": "signal-exit@3.0.7" + } + }, + "run-async@2.4.1": { + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dependencies": {} + }, + "rxjs@6.6.7": { + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dependencies": { - "@shikijs/core": "@shikijs/core@1.21.0", - "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", - "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "tslib": "tslib@1.14.1" + } + }, + "rxjs@7.8.1": { + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "tslib@2.6.2" + } + }, + "safe-buffer@5.2.1": { + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dependencies": {} + }, + "safer-buffer@2.1.2": { + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dependencies": {} + }, + "shiki@0.14.7": { + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "dependencies": { + "ansi-sequence-parser": "ansi-sequence-parser@1.1.1", + "jsonc-parser": "jsonc-parser@3.2.1", + "vscode-oniguruma": "vscode-oniguruma@1.7.0", + "vscode-textmate": "vscode-textmate@8.0.0" + } + }, + "shiki@1.16.1": { + "integrity": "sha512-tCJIMaxDVB1mEIJ5TvfZU7kCPB5eo9fli5+21Olc/bmyv+w8kye3JOp+LZRmGkAyT71hrkefQhTiY+o9mBikRQ==", + "dependencies": { + "@shikijs/core": "@shikijs/core@1.16.1", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", "@types/hast": "@types/hast@3.0.4" } }, - "space-separated-tokens@2.0.2": { - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "signal-exit@3.0.7": { + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dependencies": {} }, - "stringify-entities@4.0.4": { - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "spawn-command@0.0.2-1": { + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "dependencies": {} + }, + "string-width@4.2.3": { + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "emoji-regex@8.0.0", + "is-fullwidth-code-point": "is-fullwidth-code-point@3.0.0", + "strip-ansi": "strip-ansi@6.0.1" + } + }, + "string_decoder@1.3.0": { + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dependencies": { - "character-entities-html4": "character-entities-html4@2.1.0", - "character-entities-legacy": "character-entities-legacy@3.0.0" + "safe-buffer": "safe-buffer@5.2.1" } }, - "trim-lines@3.0.1": { - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "strip-ansi@6.0.1": { + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "ansi-regex@5.0.1" + } + }, + "supports-color@7.2.0": { + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "has-flag@4.0.0" + } + }, + "supports-color@8.1.1": { + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "has-flag@4.0.0" + } + }, + "through@2.3.8": { + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dependencies": {} }, - "typedoc@0.26.7_typescript@5.5.4": { - "integrity": "sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==", + "tmp@0.0.33": { + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dependencies": { + "os-tmpdir": "os-tmpdir@1.0.2" + } + }, + "tr46@0.0.3": { + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dependencies": {} + }, + "tree-kill@1.2.2": { + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dependencies": {} + }, + "tslib@1.14.1": { + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dependencies": {} + }, + "tslib@2.6.2": { + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dependencies": {} + }, + "type-fest@0.21.3": { + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dependencies": {} + }, + "typedoc@0.25.13_typescript@5.4.5": { + "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", + "dependencies": { + "lunr": "lunr@2.3.9", + "marked": "marked@4.3.0", + "minimatch": "minimatch@9.0.5", + "shiki": "shiki@0.14.7", + "typescript": "typescript@5.4.5" + } + }, + "typedoc@0.26.6_typescript@5.5.4": { + "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", "dependencies": { "lunr": "lunr@2.3.9", "markdown-it": "markdown-it@14.1.0", "minimatch": "minimatch@9.0.5", - "shiki": "shiki@1.21.0", + "shiki": "shiki@1.16.1", "typescript": "typescript@5.5.4", "yaml": "yaml@2.5.1" } }, + "typescript@5.4.5": { + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dependencies": {} + }, "typescript@5.5.4": { "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dependencies": {} @@ -530,60 +1052,88 @@ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dependencies": {} }, - "unist-util-is@6.0.0": { - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "uid@2.0.2": { + "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", "dependencies": { - "@types/unist": "@types/unist@3.0.3" + "@lukeed/csprng": "@lukeed/csprng@1.1.0" } }, - "unist-util-position@5.0.0": { - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } + "universalify@2.0.1": { + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dependencies": {} }, - "unist-util-stringify-position@4.0.0": { - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } + "util-deprecate@1.0.2": { + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dependencies": {} }, - "unist-util-visit-parents@6.0.1": { - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "vscode-oniguruma@1.7.0": { + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dependencies": {} + }, + "vscode-textmate@8.0.0": { + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dependencies": {} + }, + "wcwidth@1.0.1": { + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-is": "unist-util-is@6.0.0" + "defaults": "defaults@1.0.4" } }, - "unist-util-visit@5.0.0": { - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "webidl-conversions@3.0.1": { + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dependencies": {} + }, + "whatwg-url@5.0.0": { + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-is": "unist-util-is@6.0.0", - "unist-util-visit-parents": "unist-util-visit-parents@6.0.1" + "tr46": "tr46@0.0.3", + "webidl-conversions": "webidl-conversions@3.0.1" } }, - "vfile-message@4.0.2": { - "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "wrap-ansi@6.2.0": { + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-stringify-position": "unist-util-stringify-position@4.0.0" + "ansi-styles": "ansi-styles@4.3.0", + "string-width": "string-width@4.2.3", + "strip-ansi": "strip-ansi@6.0.1" } }, - "vfile@6.0.3": { - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "wrap-ansi@7.0.0": { + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "vfile-message": "vfile-message@4.0.2" + "ansi-styles": "ansi-styles@4.3.0", + "string-width": "string-width@4.2.3", + "strip-ansi": "strip-ansi@6.0.1" } }, + "wrappy@1.0.2": { + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dependencies": {} + }, + "y18n@5.0.8": { + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dependencies": {} + }, "yaml@2.5.1": { "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", "dependencies": {} }, - "zwitch@2.0.4": { - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "yargs-parser@20.2.9": { + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dependencies": {} + }, + "yargs@16.2.0": { + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "cliui@7.0.4", + "escalade": "escalade@3.1.2", + "get-caller-file": "get-caller-file@2.0.5", + "require-directory": "require-directory@2.1.1", + "string-width": "string-width@4.2.3", + "y18n": "y18n@5.0.8", + "yargs-parser": "yargs-parser@20.2.9" + } } } }, @@ -592,7 +1142,7 @@ }, "workspace": { "dependencies": [ - "jsr:@deno/dnt@^0.41.3", + "jsr:@deno/dnt@^0.41.2", "jsr:@std/assert@^1.0.0", "jsr:@std/fs@^1.0.0", "jsr:@std/jsonc@^1.0.0", diff --git a/flake.nix b/flake.nix index 650b312..e18baa4 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ # can't use slim here as long as we still publish with npm. # TODO(@joscha) change this once we only publish to jsr only nodejs_20 - # jre + jre openapi-generator-cli yamllint yamlfmt diff --git a/src/v2/generated/.gitattributes b/src/v2/generated/.gitattributes new file mode 100644 index 0000000..7bf5a17 --- /dev/null +++ b/src/v2/generated/.gitattributes @@ -0,0 +1,8 @@ +**/* linguist-generated +*.md linguist-documentation + +.gitattributes text +.gitattributes export-ignore + +.gitignore text +.gitignore export-ignore diff --git a/src/v2/generated/.gitignore b/src/v2/generated/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/src/v2/generated/.gitignore @@ -0,0 +1 @@ +dist diff --git a/src/v2/generated/.openapi-generator-ignore b/src/v2/generated/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/src/v2/generated/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/src/v2/generated/.openapi-generator/FILES b/src/v2/generated/.openapi-generator/FILES new file mode 100644 index 0000000..ff23f31 --- /dev/null +++ b/src/v2/generated/.openapi-generator/FILES @@ -0,0 +1,107 @@ +.gitattributes +.gitignore +.openapi-generator-ignore +AuthApi.md +CompaniesApi.md +ListsApi.md +OpportunitiesApi.md +PersonsApi.md +apis/AuthApi.ts +apis/CompaniesApi.ts +apis/ListsApi.ts +apis/OpportunitiesApi.ts +apis/PersonsApi.ts +apis/baseapi.ts +apis/exception.ts +auth/auth.ts +configuration.ts +git_push.sh +http/http.ts +http/isomorphic-fetch.ts +index.ts +middleware.ts +models/Attendee.ts +models/AuthenticationError.ts +models/AuthenticationErrors.ts +models/AuthorizationError.ts +models/AuthorizationErrors.ts +models/ChatMessage.ts +models/CompaniesValue.ts +models/Company.ts +models/CompanyData.ts +models/CompanyListEntry.ts +models/CompanyPaged.ts +models/CompanyValue.ts +models/ConflictError.ts +models/DateValue.ts +models/Dropdown.ts +models/DropdownValue.ts +models/DropdownsValue.ts +models/Email.ts +models/EmptyMessageBodyError.ts +models/Errors.ts +models/Field.ts +models/FieldMetadata.ts +models/FieldMetadataPaged.ts +models/FieldValue.ts +models/FloatValue.ts +models/FloatsValue.ts +models/FormulaNumber.ts +models/FormulaValue.ts +models/GenericError.ts +models/Grant.ts +models/Interaction.ts +models/InteractionValue.ts +models/InvalidAcceptHeaderError.ts +models/InvalidMessageBodyError.ts +models/InvalidVersionHeaderError.ts +models/List.ts +models/ListEntry.ts +models/ListEntryPaged.ts +models/ListEntryWithEntity.ts +models/ListEntryWithEntityPaged.ts +models/ListPaged.ts +models/ListWithType.ts +models/ListWithTypePaged.ts +models/Location.ts +models/LocationValue.ts +models/LocationsValue.ts +models/Meeting.ts +models/MethodNotAllowedError.ts +models/ModelError.ts +models/NotFoundError.ts +models/NotFoundErrors.ts +models/ObjectSerializer.ts +models/Opportunity.ts +models/OpportunityListEntry.ts +models/OpportunityPaged.ts +models/OpportunityWithFields.ts +models/Pagination.ts +models/Person.ts +models/PersonData.ts +models/PersonListEntry.ts +models/PersonPaged.ts +models/PersonValue.ts +models/PersonsValue.ts +models/PhoneCall.ts +models/RankedDropdown.ts +models/RankedDropdownValue.ts +models/RateLimitError.ts +models/SavedView.ts +models/SavedViewPaged.ts +models/ServerError.ts +models/Tenant.ts +models/TextValue.ts +models/TextsValue.ts +models/TooManyMultipartFilesError.ts +models/User.ts +models/ValidationError.ts +models/ValidationErrors.ts +models/WhoAmI.ts +models/all.ts +rxjsStub.ts +servers.ts +types/ObjectParamAPI.ts +types/ObservableAPI.ts +types/PromiseAPI.ts +util.ts diff --git a/src/v2/generated/.openapi-generator/VERSION b/src/v2/generated/.openapi-generator/VERSION new file mode 100644 index 0000000..17f2442 --- /dev/null +++ b/src/v2/generated/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0-SNAPSHOT diff --git a/src/v2/generated/AuthApi.md b/src/v2/generated/AuthApi.md new file mode 100644 index 0000000..c36fb50 --- /dev/null +++ b/src/v2/generated/AuthApi.md @@ -0,0 +1,58 @@ +# Affinity.AuthApi + +All URIs are relative to *https://api.affinity.co* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getV2AuthWhoami**](AuthApi.md#getV2AuthWhoami) | **GET** /v2/auth/whoami | Get current user + + +# **getV2AuthWhoami** +> WhoAmI getV2AuthWhoami() + +Returns metadata about the current user. + +### Example + + +```typescript +import { createConfiguration, AuthApi } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new AuthApi(configuration); + +const request = {}; + +const data = await apiInstance.getV2AuthWhoami(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**WhoAmI** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get current user | - | +**401** | Unauthorized | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/src/v2/generated/CompaniesApi.md b/src/v2/generated/CompaniesApi.md new file mode 100644 index 0000000..0104823 --- /dev/null +++ b/src/v2/generated/CompaniesApi.md @@ -0,0 +1,333 @@ +# Affinity.CompaniesApi + +All URIs are relative to *https://api.affinity.co* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getV2Companies**](CompaniesApi.md#getV2Companies) | **GET** /v2/companies | Get all Companies +[**getV2CompaniesFields**](CompaniesApi.md#getV2CompaniesFields) | **GET** /v2/companies/fields | Get metadata on Company Fields +[**getV2CompaniesId**](CompaniesApi.md#getV2CompaniesId) | **GET** /v2/companies/{id} | Get a single Company +[**getV2CompaniesIdListEntries**](CompaniesApi.md#getV2CompaniesIdListEntries) | **GET** /v2/companies/{id}/list-entries | Get a Company\'s List Entries +[**getV2CompaniesIdLists**](CompaniesApi.md#getV2CompaniesIdLists) | **GET** /v2/companies/{id}/lists | Get a Company\'s Lists + + +# **getV2Companies** +> CompanyPaged getV2Companies() + +Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; +import type { CompaniesApiGetV2CompaniesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new CompaniesApi(configuration); + +const request: CompaniesApiGetV2CompaniesRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, + // Company IDs (optional) + ids: [ + 1, + ], + // Field IDs for which to return field data (optional) + fieldIds: [ + "fieldIds_example", + ], + // Field Types for which to return field data (optional) + fieldTypes: [ + "enriched", + ], +}; + +const data = await apiInstance.getV2Companies(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + **ids** | **Array<number>** | Company IDs | (optional) defaults to undefined + **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined + **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined + + +### Return type + +**CompanyPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get all Companies | - | +**400** | Bad Request | - | +**403** | Forbidden | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2CompaniesFields** +> FieldMetadataPaged getV2CompaniesFields() + +Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + +### Example + + +```typescript +import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; +import type { CompaniesApiGetV2CompaniesFieldsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new CompaniesApi(configuration); + +const request: CompaniesApiGetV2CompaniesFieldsRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2CompaniesFields(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**FieldMetadataPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on Company Fields | - | +**400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2CompaniesId** +> Company getV2CompaniesId() + +Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; +import type { CompaniesApiGetV2CompaniesIdRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new CompaniesApi(configuration); + +const request: CompaniesApiGetV2CompaniesIdRequest = { + // Company ID + id: 1, + // Field IDs for which to return field data (optional) + fieldIds: [ + "fieldIds_example", + ], + // Field Types for which to return field data (optional) + fieldTypes: [ + "enriched", + ], +}; + +const data = await apiInstance.getV2CompaniesId(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Company ID | defaults to undefined + **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined + **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined + + +### Return type + +**Company** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a single Company | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2CompaniesIdListEntries** +> ListEntryPaged getV2CompaniesIdListEntries() + +Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; +import type { CompaniesApiGetV2CompaniesIdListEntriesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new CompaniesApi(configuration); + +const request: CompaniesApiGetV2CompaniesIdListEntriesRequest = { + // Company ID + id: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2CompaniesIdListEntries(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Company ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListEntryPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a Company\'s List Entries | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2CompaniesIdLists** +> ListPaged getV2CompaniesIdLists() + +Returns metadata for all the Lists on which the given Company appears. + +### Example + + +```typescript +import { createConfiguration, CompaniesApi } from '@planet-a/affinity-node/v2'; +import type { CompaniesApiGetV2CompaniesIdListsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new CompaniesApi(configuration); + +const request: CompaniesApiGetV2CompaniesIdListsRequest = { + // Company ID + id: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2CompaniesIdLists(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Company ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a Company\'s Lists | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/src/v2/generated/ListsApi.md b/src/v2/generated/ListsApi.md new file mode 100644 index 0000000..9de2695 --- /dev/null +++ b/src/v2/generated/ListsApi.md @@ -0,0 +1,445 @@ +# Affinity.ListsApi + +All URIs are relative to *https://api.affinity.co* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getV2Lists**](ListsApi.md#getV2Lists) | **GET** /v2/lists | Get metadata on all Lists +[**getV2ListsListid**](ListsApi.md#getV2ListsListid) | **GET** /v2/lists/{listId} | Get metadata on a single List +[**getV2ListsListidFields**](ListsApi.md#getV2ListsListidFields) | **GET** /v2/lists/{listId}/fields | Get metadata on a single List\'s Fields +[**getV2ListsListidListEntries**](ListsApi.md#getV2ListsListidListEntries) | **GET** /v2/lists/{listId}/list-entries | Get all List Entries on a List +[**getV2ListsListidSavedViews**](ListsApi.md#getV2ListsListidSavedViews) | **GET** /v2/lists/{listId}/saved-views | Get metadata on Saved Views +[**getV2ListsListidSavedViewsViewid**](ListsApi.md#getV2ListsListidSavedViewsViewid) | **GET** /v2/lists/{listId}/saved-views/{viewId} | Get metadata on a single Saved View +[**getV2ListsListidSavedViewsViewidListEntries**](ListsApi.md#getV2ListsListidSavedViewsViewidListEntries) | **GET** /v2/lists/{listId}/saved-views/{viewId}/list-entries | Get all List Entries on a Saved View + + +# **getV2Lists** +> ListWithTypePaged getV2Lists() + +Returns metadata on Lists. + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2Lists(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListWithTypePaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on all Lists | - | +**400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListid** +> ListWithType getV2ListsListid() + +Returns metadata on a single List. + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidRequest = { + // List ID + listId: 1, +}; + +const data = await apiInstance.getV2ListsListid(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + + +### Return type + +**ListWithType** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on a single List | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListidFields** +> FieldMetadataPaged getV2ListsListidFields() + +Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidFieldsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidFieldsRequest = { + // List ID + listId: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2ListsListidFields(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**FieldMetadataPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on a single List\'s Fields | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListidListEntries** +> ListEntryWithEntityPaged getV2ListsListidListEntries() + +Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidListEntriesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidListEntriesRequest = { + // List ID + listId: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, + // Field IDs for which to return field data (optional) + fieldIds: [ + "fieldIds_example", + ], + // Field Types for which to return field data (optional) + fieldTypes: [ + "enriched", + ], +}; + +const data = await apiInstance.getV2ListsListidListEntries(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined + **fieldTypes** | **Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined + + +### Return type + +**ListEntryWithEntityPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get all List Entries on a List | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListidSavedViews** +> SavedViewPaged getV2ListsListidSavedViews() + +Returns metadata on the Saved Views on a List. + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidSavedViewsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidSavedViewsRequest = { + // List ID + listId: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2ListsListidSavedViews(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**SavedViewPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on Saved Views | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListidSavedViewsViewid** +> SavedView getV2ListsListidSavedViewsViewid() + +Returns metadata on a single Saved View. + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidSavedViewsViewidRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidSavedViewsViewidRequest = { + // List ID + listId: 1, + // Saved view ID + viewId: 1, +}; + +const data = await apiInstance.getV2ListsListidSavedViewsViewid(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + **viewId** | [**number**] | Saved view ID | defaults to undefined + + +### Return type + +**SavedView** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on a single Saved View | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2ListsListidSavedViewsViewidListEntries** +> ListEntryWithEntityPaged getV2ListsListidSavedViewsViewidListEntries() + +Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, ListsApi } from '@planet-a/affinity-node/v2'; +import type { ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new ListsApi(configuration); + +const request: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest = { + // List ID + listId: 1, + // Saved view ID + viewId: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2ListsListidSavedViewsViewidListEntries(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **listId** | [**number**] | List ID | defaults to undefined + **viewId** | [**number**] | Saved view ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListEntryWithEntityPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get all List Entries on a Saved View | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/src/v2/generated/OpportunitiesApi.md b/src/v2/generated/OpportunitiesApi.md new file mode 100644 index 0000000..1b692ad --- /dev/null +++ b/src/v2/generated/OpportunitiesApi.md @@ -0,0 +1,130 @@ +# Affinity.OpportunitiesApi + +All URIs are relative to *https://api.affinity.co* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getV2Opportunities**](OpportunitiesApi.md#getV2Opportunities) | **GET** /v2/opportunities | Get all Opportunities +[**getV2OpportunitiesId**](OpportunitiesApi.md#getV2OpportunitiesId) | **GET** /v2/opportunities/{id} | Get a single Opportunity + + +# **getV2Opportunities** +> OpportunityPaged getV2Opportunities() + +Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, OpportunitiesApi } from '@planet-a/affinity-node/v2'; +import type { OpportunitiesApiGetV2OpportunitiesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new OpportunitiesApi(configuration); + +const request: OpportunitiesApiGetV2OpportunitiesRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, + // Opportunity IDs (optional) + ids: [ + 1, + ], +}; + +const data = await apiInstance.getV2Opportunities(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + **ids** | **Array<number>** | Opportunity IDs | (optional) defaults to undefined + + +### Return type + +**OpportunityPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get all Opportunities | - | +**400** | Bad Request | - | +**403** | Forbidden | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2OpportunitiesId** +> Opportunity getV2OpportunitiesId() + +Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, OpportunitiesApi } from '@planet-a/affinity-node/v2'; +import type { OpportunitiesApiGetV2OpportunitiesIdRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new OpportunitiesApi(configuration); + +const request: OpportunitiesApiGetV2OpportunitiesIdRequest = { + // Opportunity ID + id: 1, +}; + +const data = await apiInstance.getV2OpportunitiesId(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Opportunity ID | defaults to undefined + + +### Return type + +**Opportunity** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a single Opportunity | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/src/v2/generated/PersonsApi.md b/src/v2/generated/PersonsApi.md new file mode 100644 index 0000000..5038882 --- /dev/null +++ b/src/v2/generated/PersonsApi.md @@ -0,0 +1,333 @@ +# Affinity.PersonsApi + +All URIs are relative to *https://api.affinity.co* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getV2Persons**](PersonsApi.md#getV2Persons) | **GET** /v2/persons | Get all Persons +[**getV2PersonsFields**](PersonsApi.md#getV2PersonsFields) | **GET** /v2/persons/fields | Get metadata on Person Fields +[**getV2PersonsId**](PersonsApi.md#getV2PersonsId) | **GET** /v2/persons/{id} | Get a single Person +[**getV2PersonsIdListEntries**](PersonsApi.md#getV2PersonsIdListEntries) | **GET** /v2/persons/{id}/list-entries | Get a Person\'s List Entries +[**getV2PersonsIdLists**](PersonsApi.md#getV2PersonsIdLists) | **GET** /v2/persons/{id}/lists | Get a Person\'s Lists + + +# **getV2Persons** +> PersonPaged getV2Persons() + +Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; +import type { PersonsApiGetV2PersonsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new PersonsApi(configuration); + +const request: PersonsApiGetV2PersonsRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, + // People IDs (optional) + ids: [ + 1, + ], + // Field IDs for which to return field data (optional) + fieldIds: [ + "fieldIds_example", + ], + // Field Types for which to return field data (optional) + fieldTypes: [ + "enriched", + ], +}; + +const data = await apiInstance.getV2Persons(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + **ids** | **Array<number>** | People IDs | (optional) defaults to undefined + **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined + **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined + + +### Return type + +**PersonPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get all Persons | - | +**400** | Bad Request | - | +**403** | Forbidden | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2PersonsFields** +> FieldMetadataPaged getV2PersonsFields() + +Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + +### Example + + +```typescript +import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; +import type { PersonsApiGetV2PersonsFieldsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new PersonsApi(configuration); + +const request: PersonsApiGetV2PersonsFieldsRequest = { + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2PersonsFields(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**FieldMetadataPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get metadata on Person Fields | - | +**400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2PersonsId** +> Person getV2PersonsId() + +Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; +import type { PersonsApiGetV2PersonsIdRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new PersonsApi(configuration); + +const request: PersonsApiGetV2PersonsIdRequest = { + // Person ID + id: 1, + // Field IDs for which to return field data (optional) + fieldIds: [ + "fieldIds_example", + ], + // Field Types for which to return field data (optional) + fieldTypes: [ + "enriched", + ], +}; + +const data = await apiInstance.getV2PersonsId(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Person ID | defaults to undefined + **fieldIds** | **Array<string>** | Field IDs for which to return field data | (optional) defaults to undefined + **fieldTypes** | **Array<'enriched' | 'global' | 'relationship-intelligence'>** | Field Types for which to return field data | (optional) defaults to undefined + + +### Return type + +**Person** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a single Person | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2PersonsIdListEntries** +> ListEntryPaged getV2PersonsIdListEntries() + +Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + +### Example + + +```typescript +import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; +import type { PersonsApiGetV2PersonsIdListEntriesRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new PersonsApi(configuration); + +const request: PersonsApiGetV2PersonsIdListEntriesRequest = { + // Persons ID + id: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2PersonsIdListEntries(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Persons ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListEntryPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a Person\'s List Entries | - | +**400** | Bad Request | - | +**403** | Forbidden | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getV2PersonsIdLists** +> ListPaged getV2PersonsIdLists() + +Returns metadata for all the Lists on which the given Person appears. + +### Example + + +```typescript +import { createConfiguration, PersonsApi } from '@planet-a/affinity-node/v2'; +import type { PersonsApiGetV2PersonsIdListsRequest } from '@planet-a/affinity-node/v2'; + +const configuration = createConfiguration(); +const apiInstance = new PersonsApi(configuration); + +const request: PersonsApiGetV2PersonsIdListsRequest = { + // Persons ID + id: 1, + // Cursor for the next or previous page (optional) + cursor: "cursor_example", + // Number of items to include in the page (optional) + limit: 100, +}; + +const data = await apiInstance.getV2PersonsIdLists(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | [**number**] | Persons ID | defaults to undefined + **cursor** | [**string**] | Cursor for the next or previous page | (optional) defaults to undefined + **limit** | [**number**] | Number of items to include in the page | (optional) defaults to 100 + + +### Return type + +**ListPaged** + +### Authorization + +[bearerAuth](README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get a Person\'s Lists | - | +**400** | Bad Request | - | +**404** | Not Found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/src/v2/generated/apis/AuthApi.ts b/src/v2/generated/apis/AuthApi.ts new file mode 100644 index 0000000..2fb613d --- /dev/null +++ b/src/v2/generated/apis/AuthApi.ts @@ -0,0 +1,97 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; +import {Configuration} from '../configuration.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; +import {ApiException} from './exception.ts'; +import {canConsumeForm, isCodeInRange} from '../util.ts'; +import {SecurityAuthentication} from '../auth/auth.ts'; + + +import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { WhoAmI } from '../models/WhoAmI.ts'; + +/** + * no description + */ +export class AuthApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Returns metadata about the current user. + * Get current user + */ + public async getV2AuthWhoami(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/v2/auth/whoami'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class AuthApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2AuthWhoami + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2AuthWhoamiWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: WhoAmI = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WhoAmI", "" + ) as WhoAmI; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("401", response.httpStatusCode)) { + const body: AuthenticationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthenticationErrors", "" + ) as AuthenticationErrors; + throw new ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: WhoAmI = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "WhoAmI", "" + ) as WhoAmI; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/v2/generated/apis/CompaniesApi.ts b/src/v2/generated/apis/CompaniesApi.ts new file mode 100644 index 0000000..75826ab --- /dev/null +++ b/src/v2/generated/apis/CompaniesApi.ts @@ -0,0 +1,531 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; +import {Configuration} from '../configuration.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; +import {ApiException} from './exception.ts'; +import {canConsumeForm, isCodeInRange} from '../util.ts'; +import {SecurityAuthentication} from '../auth/auth.ts'; + + +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { Company } from '../models/Company.ts'; +import { CompanyPaged } from '../models/CompanyPaged.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; + +/** + * no description + */ +export class CompaniesApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + * @param ids Company IDs + * @param fieldIds Field IDs for which to return field data + * @param fieldTypes Field Types for which to return field data + */ + public async getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + + + // Path Params + const localVarPath = '/v2/companies'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (ids !== undefined) { + const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("ids", serializedParam); + } + } + + // Query Params + if (fieldIds !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldIds", serializedParam); + } + } + + // Query Params + if (fieldTypes !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldTypes", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/v2/companies/fields'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param id Company ID + * @param fieldIds Field IDs for which to return field data + * @param fieldTypes Field Types for which to return field data + */ + public async getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("CompaniesApi", "getV2CompaniesId", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/companies/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (fieldIds !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldIds", serializedParam); + } + } + + // Query Params + if (fieldTypes !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldTypes", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param id Company ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("CompaniesApi", "getV2CompaniesIdListEntries", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/companies/{id}/list-entries' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param id Company ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("CompaniesApi", "getV2CompaniesIdLists", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/companies/{id}/lists' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class CompaniesApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2Companies + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2CompaniesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: CompanyPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CompanyPaged", "" + ) as CompanyPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CompanyPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CompanyPaged", "" + ) as CompanyPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2CompaniesFields + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2CompaniesFieldsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2CompaniesId + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2CompaniesIdWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Company = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Company", "" + ) as Company; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Company = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Company", "" + ) as Company; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2CompaniesIdListEntries + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2CompaniesIdListEntriesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListEntryPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryPaged", "" + ) as ListEntryPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListEntryPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryPaged", "" + ) as ListEntryPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2CompaniesIdLists + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2CompaniesIdListsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListPaged", "" + ) as ListPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListPaged", "" + ) as ListPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/v2/generated/apis/ListsApi.ts b/src/v2/generated/apis/ListsApi.ts new file mode 100644 index 0000000..18e13a4 --- /dev/null +++ b/src/v2/generated/apis/ListsApi.ts @@ -0,0 +1,702 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; +import {Configuration} from '../configuration.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; +import {ApiException} from './exception.ts'; +import {canConsumeForm, isCodeInRange} from '../util.ts'; +import {SecurityAuthentication} from '../auth/auth.ts'; + + +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; +import { ListWithType } from '../models/ListWithType.ts'; +import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { SavedView } from '../models/SavedView.ts'; +import { SavedViewPaged } from '../models/SavedViewPaged.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; + +/** + * no description + */ +export class ListsApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/v2/lists'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param listId List ID + */ + public async getV2ListsListid(listId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListid", "listId"); + } + + + // Path Params + const localVarPath = '/v2/lists/{listId}' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param listId List ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidFields", "listId"); + } + + + + + // Path Params + const localVarPath = '/v2/lists/{listId}/fields' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param listId List ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + * @param fieldIds Field IDs for which to return field data + * @param fieldTypes Field Types for which to return field data + */ + public async getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidListEntries", "listId"); + } + + + + + + + // Path Params + const localVarPath = '/v2/lists/{listId}/list-entries' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (fieldIds !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldIds", serializedParam); + } + } + + // Query Params + if (fieldTypes !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldTypes", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param listId List ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidSavedViews", "listId"); + } + + + + + // Path Params + const localVarPath = '/v2/lists/{listId}/saved-views' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param listId List ID + * @param viewId Saved view ID + */ + public async getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewid", "listId"); + } + + + // verify required parameter 'viewId' is not null or undefined + if (viewId === null || viewId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewid", "viewId"); + } + + + // Path Params + const localVarPath = '/v2/lists/{listId}/saved-views/{viewId}' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))) + .replace('{' + 'viewId' + '}', encodeURIComponent(String(viewId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param listId List ID + * @param viewId Saved view ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'listId' is not null or undefined + if (listId === null || listId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewidListEntries", "listId"); + } + + + // verify required parameter 'viewId' is not null or undefined + if (viewId === null || viewId === undefined) { + throw new RequiredError("ListsApi", "getV2ListsListidSavedViewsViewidListEntries", "viewId"); + } + + + + + // Path Params + const localVarPath = '/v2/lists/{listId}/saved-views/{viewId}/list-entries' + .replace('{' + 'listId' + '}', encodeURIComponent(String(listId))) + .replace('{' + 'viewId' + '}', encodeURIComponent(String(viewId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class ListsApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2Lists + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListWithTypePaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListWithTypePaged", "" + ) as ListWithTypePaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListWithTypePaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListWithTypePaged", "" + ) as ListWithTypePaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListid + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListWithType = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListWithType", "" + ) as ListWithType; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListWithType = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListWithType", "" + ) as ListWithType; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListidFields + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidFieldsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListidListEntries + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidListEntriesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryWithEntityPaged", "" + ) as ListEntryWithEntityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryWithEntityPaged", "" + ) as ListEntryWithEntityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListidSavedViews + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidSavedViewsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: SavedViewPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SavedViewPaged", "" + ) as SavedViewPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: SavedViewPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SavedViewPaged", "" + ) as SavedViewPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListidSavedViewsViewid + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidSavedViewsViewidWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: SavedView = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SavedView", "" + ) as SavedView; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: SavedView = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SavedView", "" + ) as SavedView; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2ListsListidSavedViewsViewidListEntries + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryWithEntityPaged", "" + ) as ListEntryWithEntityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListEntryWithEntityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryWithEntityPaged", "" + ) as ListEntryWithEntityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/v2/generated/apis/OpportunitiesApi.ts b/src/v2/generated/apis/OpportunitiesApi.ts new file mode 100644 index 0000000..3029969 --- /dev/null +++ b/src/v2/generated/apis/OpportunitiesApi.ts @@ -0,0 +1,211 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; +import {Configuration} from '../configuration.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; +import {ApiException} from './exception.ts'; +import {canConsumeForm, isCodeInRange} from '../util.ts'; +import {SecurityAuthentication} from '../auth/auth.ts'; + + +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Opportunity } from '../models/Opportunity.ts'; +import { OpportunityPaged } from '../models/OpportunityPaged.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; + +/** + * no description + */ +export class OpportunitiesApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + * @param ids Opportunity IDs + */ + public async getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + // Path Params + const localVarPath = '/v2/opportunities'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (ids !== undefined) { + const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("ids", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param id Opportunity ID + */ + public async getV2OpportunitiesId(id: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("OpportunitiesApi", "getV2OpportunitiesId", "id"); + } + + + // Path Params + const localVarPath = '/v2/opportunities/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class OpportunitiesApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2Opportunities + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2OpportunitiesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: OpportunityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OpportunityPaged", "" + ) as OpportunityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OpportunityPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OpportunityPaged", "" + ) as OpportunityPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2OpportunitiesId + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2OpportunitiesIdWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Opportunity = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Opportunity", "" + ) as Opportunity; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Opportunity = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Opportunity", "" + ) as Opportunity; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/v2/generated/apis/PersonsApi.ts b/src/v2/generated/apis/PersonsApi.ts new file mode 100644 index 0000000..5350746 --- /dev/null +++ b/src/v2/generated/apis/PersonsApi.ts @@ -0,0 +1,531 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; +import {Configuration} from '../configuration.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; +import {ApiException} from './exception.ts'; +import {canConsumeForm, isCodeInRange} from '../util.ts'; +import {SecurityAuthentication} from '../auth/auth.ts'; + + +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Person } from '../models/Person.ts'; +import { PersonPaged } from '../models/PersonPaged.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; + +/** + * no description + */ +export class PersonsApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + * @param ids People IDs + * @param fieldIds Field IDs for which to return field data + * @param fieldTypes Field Types for which to return field data + */ + public async getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + + + // Path Params + const localVarPath = '/v2/persons'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + // Query Params + if (ids !== undefined) { + const serializedParams = ObjectSerializer.serialize(ids, "Array", "int64"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("ids", serializedParam); + } + } + + // Query Params + if (fieldIds !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldIds", serializedParam); + } + } + + // Query Params + if (fieldTypes !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldTypes", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/v2/persons/fields'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param id Person ID + * @param fieldIds Field IDs for which to return field data + * @param fieldTypes Field Types for which to return field data + */ + public async getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("PersonsApi", "getV2PersonsId", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/persons/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (fieldIds !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldIds, "Array", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldIds", serializedParam); + } + } + + // Query Params + if (fieldTypes !== undefined) { + const serializedParams = ObjectSerializer.serialize(fieldTypes, "Array<'enriched' | 'global' | 'relationship-intelligence'>", "string"); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("fieldTypes", serializedParam); + } + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param id Persons ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("PersonsApi", "getV2PersonsIdListEntries", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/persons/{id}/list-entries' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param id Persons ID + * @param cursor Cursor for the next or previous page + * @param limit Number of items to include in the page + */ + public async getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError("PersonsApi", "getV2PersonsIdLists", "id"); + } + + + + + // Path Params + const localVarPath = '/v2/persons/{id}/lists' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (cursor !== undefined) { + requestContext.setQueryParam("cursor", ObjectSerializer.serialize(cursor, "string", "")); + } + + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearerAuth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class PersonsApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2Persons + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2PersonsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: PersonPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "PersonPaged", "" + ) as PersonPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: PersonPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "PersonPaged", "" + ) as PersonPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2PersonsFields + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2PersonsFieldsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FieldMetadataPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FieldMetadataPaged", "" + ) as FieldMetadataPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2PersonsId + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2PersonsIdWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Person = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Person", "" + ) as Person; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Person = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Person", "" + ) as Person; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2PersonsIdListEntries + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2PersonsIdListEntriesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListEntryPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryPaged", "" + ) as ListEntryPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("403", response.httpStatusCode)) { + const body: AuthorizationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AuthorizationErrors", "" + ) as AuthorizationErrors; + throw new ApiException(response.httpStatusCode, "Forbidden", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListEntryPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListEntryPaged", "" + ) as ListEntryPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getV2PersonsIdLists + * @throws ApiException if the response code was not in [200, 299] + */ + public async getV2PersonsIdListsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListPaged", "" + ) as ListPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + const body: ValidationErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ValidationErrors", "" + ) as ValidationErrors; + throw new ApiException(response.httpStatusCode, "Bad Request", body, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + const body: NotFoundErrors = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotFoundErrors", "" + ) as NotFoundErrors; + throw new ApiException(response.httpStatusCode, "Not Found", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListPaged = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListPaged", "" + ) as ListPaged; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/src/v2/generated/apis/baseapi.ts b/src/v2/generated/apis/baseapi.ts new file mode 100644 index 0000000..46ed74b --- /dev/null +++ b/src/v2/generated/apis/baseapi.ts @@ -0,0 +1,37 @@ +import { Configuration } from '../configuration.ts' + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPIRequestFactory { + + constructor(protected configuration: Configuration) { + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public api: string, public method: string, public field: string) { + super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); + } +} diff --git a/src/v2/generated/apis/exception.ts b/src/v2/generated/apis/exception.ts new file mode 100644 index 0000000..9365d33 --- /dev/null +++ b/src/v2/generated/apis/exception.ts @@ -0,0 +1,15 @@ +/** + * Represents an error caused by an api call i.e. it has attributes for a HTTP status code + * and the returned body object. + * + * Example + * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] + * => ApiException(404, someErrorMessageObject) + * + */ +export class ApiException extends Error { + public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { + super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + + JSON.stringify(headers)) + } +} diff --git a/src/v2/generated/auth/auth.ts b/src/v2/generated/auth/auth.ts new file mode 100644 index 0000000..8763a5a --- /dev/null +++ b/src/v2/generated/auth/auth.ts @@ -0,0 +1,79 @@ +import { RequestContext } from "../http/http.ts"; + +/** + * Interface authentication schemes. + */ +export interface SecurityAuthentication { + /* + * @return returns the name of the security authentication as specified in OAI + */ + getName(): string; + + /** + * Applies the authentication scheme to the request context + * + * @params context the request context which should use this authentication scheme + */ + applySecurityAuthentication(context: RequestContext): void | Promise; +} + +export interface TokenProvider { + getToken(): Promise | string; +} + +/** + * Applies http authentication to the request context. + */ +export class BearerAuthAuthentication implements SecurityAuthentication { + /** + * Configures the http authentication with the required details. + * + * @param tokenProvider service that can provide the up-to-date token when needed + */ + public constructor(private tokenProvider: TokenProvider) {} + + public getName(): string { + return "bearerAuth"; + } + + public async applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("Authorization", "Bearer " + await this.tokenProvider.getToken()); + } +} + + +export type AuthMethods = { + "default"?: SecurityAuthentication, + "bearerAuth"?: SecurityAuthentication +} + +export type ApiKeyConfiguration = string; +export type HttpBasicConfiguration = { "username": string, "password": string }; +export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; +export type OAuth2Configuration = { accessToken: string }; + +export type AuthMethodsConfiguration = { + "default"?: SecurityAuthentication, + "bearerAuth"?: HttpBearerConfiguration +} + +/** + * Creates the authentication methods from a swagger description. + * + */ +export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { + let authMethods: AuthMethods = {} + + if (!config) { + return authMethods; + } + authMethods["default"] = config["default"] + + if (config["bearerAuth"]) { + authMethods["bearerAuth"] = new BearerAuthAuthentication( + config["bearerAuth"]["tokenProvider"] + ); + } + + return authMethods; +} \ No newline at end of file diff --git a/src/v2/generated/configuration.ts b/src/v2/generated/configuration.ts new file mode 100644 index 0000000..0a170f0 --- /dev/null +++ b/src/v2/generated/configuration.ts @@ -0,0 +1,82 @@ +import { HttpLibrary } from "./http/http.ts"; +import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware.ts"; +import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch.ts"; +import { BaseServerConfiguration, server1 } from "./servers.ts"; +import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth.ts"; + +export interface Configuration { + readonly baseServer: BaseServerConfiguration; + readonly httpApi: HttpLibrary; + readonly middleware: Middleware[]; + readonly authMethods: AuthMethods; +} + + +/** + * Interface with which a configuration object can be configured. + */ +export interface ConfigurationParameters { + /** + * Default server to use - a list of available servers (according to the + * OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also + * create your own server with the `ServerConfiguration` class from the same + * file. + */ + baseServer?: BaseServerConfiguration; + /** + * HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as + * all generators come with a default library. + * If available, additional libraries can be imported from `./http/*` + */ + httpApi?: HttpLibrary; + + /** + * The middlewares which will be applied to requests and responses. You can + * add any number of middleware components to modify requests before they + * are sent or before they are deserialized by implementing the `Middleware` + * interface defined in `./middleware` + */ + middleware?: Middleware[]; + /** + * Configures middleware functions that return promises instead of + * Observables (which are used by `middleware`). Otherwise allows for the + * same functionality as `middleware`, i.e., modifying requests before they + * are sent and before they are deserialized. + */ + promiseMiddleware?: PromiseMiddleware[]; + /** + * Configuration for the available authentication methods (e.g., api keys) + * according to the OpenAPI yaml definition. For the definition, please refer to + * `./auth/auth` + */ + authMethods?: AuthMethodsConfiguration +} + +/** + * Provide your `ConfigurationParameters` to this function to get a `Configuration` + * object that can be used to configure your APIs (in the constructor or + * for each request individually). + * + * If a property is not included in conf, a default is used: + * - baseServer: server1 + * - httpApi: IsomorphicFetchHttpLibrary + * - middleware: [] + * - promiseMiddleware: [] + * - authMethods: {} + * + * @param conf partial configuration + */ +export function createConfiguration(conf: ConfigurationParameters = {}): Configuration { + const configuration: Configuration = { + baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, + httpApi: conf.httpApi || new DefaultHttpLibrary(), + middleware: conf.middleware || [], + authMethods: configureAuthMethods(conf.authMethods) + }; + if (conf.promiseMiddleware) { + conf.promiseMiddleware.forEach( + m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) + ); + } + return configuration; +} \ No newline at end of file diff --git a/src/v2/generated/git_push.sh b/src/v2/generated/git_push.sh new file mode 100644 index 0000000..b253029 --- /dev/null +++ b/src/v2/generated/git_push.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/src/v2/generated/http/http.ts b/src/v2/generated/http/http.ts new file mode 100644 index 0000000..231a58d --- /dev/null +++ b/src/v2/generated/http/http.ts @@ -0,0 +1,244 @@ +import { Observable, from } from '../rxjsStub.ts'; + + +/** + * Represents an HTTP method. + */ +export enum HttpMethod { + GET = "GET", + HEAD = "HEAD", + POST = "POST", + PUT = "PUT", + DELETE = "DELETE", + CONNECT = "CONNECT", + OPTIONS = "OPTIONS", + TRACE = "TRACE", + PATCH = "PATCH" +} + +/** + * Represents an HTTP file which will be transferred from or to a server. + */ +export type HttpFile = Blob & { readonly name: string }; + +export class HttpException extends Error { + public constructor(msg: string) { + super(msg); + } +} + +/** + * Represents the body of an outgoing HTTP request. + */ +export type RequestBody = undefined | string | FormData | URLSearchParams; + +type Headers = Record; + +function ensureAbsoluteUrl(url: string) { + if (url.startsWith("http://") || url.startsWith("https://")) { + return url; + } + return window.location.origin + url; +} + +/** + * Represents an HTTP request context + */ +export class RequestContext { + private headers: Headers = {}; + private body: RequestBody = undefined; + private url: URL; + + /** + * Creates the request context using a http method and request resource url + * + * @param url url of the requested resource + * @param httpMethod http method + */ + public constructor(url: string, private httpMethod: HttpMethod) { + this.url = new URL(ensureAbsoluteUrl(url)); + } + + /* + * Returns the url set in the constructor including the query string + * + */ + public getUrl(): string { + return this.url.toString().endsWith("/") ? + this.url.toString().slice(0, -1) + : this.url.toString(); + } + + /** + * Replaces the url set in the constructor with this url. + * + */ + public setUrl(url: string) { + this.url = new URL(ensureAbsoluteUrl(url)); + } + + /** + * Sets the body of the http request either as a string or FormData + * + * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE + * request is discouraged. + * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 + * + * @param body the body of the request + */ + public setBody(body: RequestBody) { + this.body = body; + } + + public getHttpMethod(): HttpMethod { + return this.httpMethod; + } + + public getHeaders(): Headers { + return this.headers; + } + + public getBody(): RequestBody { + return this.body; + } + + public setQueryParam(name: string, value: string) { + this.url.searchParams.set(name, value); + } + + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + + /** + * Sets a cookie with the name and value. NO check for duplicate cookies is performed + * + */ + public addCookie(name: string, value: string): void { + if (!this.headers["Cookie"]) { + this.headers["Cookie"] = ""; + } + this.headers["Cookie"] += name + "=" + value + "; "; + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } +} + +export interface ResponseBody { + text(): Promise; + binary(): Promise; +} + +/** + * Helper class to generate a `ResponseBody` from binary data + */ +export class SelfDecodingBody implements ResponseBody { + constructor(private dataSource: Promise) {} + + binary(): Promise { + return this.dataSource; + } + + async text(): Promise { + const data: Blob = await this.dataSource; + return data.text(); + } +} + +export class ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: Headers, + public body: ResponseBody + ) {} + + /** + * Parse header value in the form `value; param1="value1"` + * + * E.g. for Content-Type or Content-Disposition + * Parameter names are converted to lower case + * The first parameter is returned with the key `""` + */ + public getParsedHeader(headerName: string): Headers { + const result: Headers = {}; + if (!this.headers[headerName]) { + return result; + } + + const parameters = this.headers[headerName].split(";"); + for (const parameter of parameters) { + let [key, value] = parameter.split("=", 2); + key = key.toLowerCase().trim(); + if (value === undefined) { + result[""] = key; + } else { + value = value.trim(); + if (value.startsWith('"') && value.endsWith('"')) { + value = value.substring(1, value.length - 1); + } + result[key] = value; + } + } + return result; + } + + public async getBodyAsFile(): Promise { + const data = await this.body.binary(); + const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; + const contentType = this.headers["content-type"] || ""; + try { + return new File([data], fileName, { type: contentType }); + } catch (error) { + /** Fallback for when the File constructor is not available */ + return Object.assign(data, { + name: fileName, + type: contentType + }); + } + } + + /** + * Use a heuristic to get a body of unknown data structure. + * Return as string if possible, otherwise as binary. + */ + public getBodyAsAny(): Promise { + try { + return this.body.text(); + } catch {} + + try { + return this.body.binary(); + } catch {} + + return Promise.resolve(undefined); + } +} + +export interface HttpLibrary { + send(request: RequestContext): Observable; +} + +export interface PromiseHttpLibrary { + send(request: RequestContext): Promise; +} + +export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); + } + } +} + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: Headers, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/src/v2/generated/http/isomorphic-fetch.ts b/src/v2/generated/http/isomorphic-fetch.ts new file mode 100644 index 0000000..a752135 --- /dev/null +++ b/src/v2/generated/http/isomorphic-fetch.ts @@ -0,0 +1,30 @@ +import {HttpLibrary, RequestContext, ResponseContext} from './http.ts'; +import { from, Observable } from '../rxjsStub.ts'; + +export class IsomorphicFetchHttpLibrary implements HttpLibrary { + + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); + + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); + + const body = { + text: () => resp.text(), + binary: () => resp.blob() + }; + return new ResponseContext(resp.status, headers, body); + }); + + return from>(resultPromise); + + } +} diff --git a/src/v2/generated/index.ts b/src/v2/generated/index.ts new file mode 100644 index 0000000..a2f2c52 --- /dev/null +++ b/src/v2/generated/index.ts @@ -0,0 +1,12 @@ +export * from "./http/http.ts"; +export * from "./auth/auth.ts"; +export * from "./models/all.ts"; +export { createConfiguration } from "./configuration.ts" +export type { Configuration } from "./configuration.ts" +export * from "./apis/exception.ts"; +export * from "./servers.ts"; +export { RequiredError } from "./apis/baseapi.ts"; + +export type { PromiseMiddleware as Middleware } from './middleware.ts'; +export { type AuthApiGetV2AuthWhoamiRequest, ObjectAuthApi as AuthApi, type CompaniesApiGetV2CompaniesRequest, type CompaniesApiGetV2CompaniesFieldsRequest, type CompaniesApiGetV2CompaniesIdRequest, type CompaniesApiGetV2CompaniesIdListEntriesRequest, type CompaniesApiGetV2CompaniesIdListsRequest, ObjectCompaniesApi as CompaniesApi, type ListsApiGetV2ListsRequest, type ListsApiGetV2ListsListidRequest, type ListsApiGetV2ListsListidFieldsRequest, type ListsApiGetV2ListsListidListEntriesRequest, type ListsApiGetV2ListsListidSavedViewsRequest, type ListsApiGetV2ListsListidSavedViewsViewidRequest, type ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, ObjectListsApi as ListsApi, type OpportunitiesApiGetV2OpportunitiesRequest, type OpportunitiesApiGetV2OpportunitiesIdRequest, ObjectOpportunitiesApi as OpportunitiesApi, type PersonsApiGetV2PersonsRequest, type PersonsApiGetV2PersonsFieldsRequest, type PersonsApiGetV2PersonsIdRequest, type PersonsApiGetV2PersonsIdListEntriesRequest, type PersonsApiGetV2PersonsIdListsRequest, ObjectPersonsApi as PersonsApi } from './types/ObjectParamAPI.ts'; + diff --git a/src/v2/generated/middleware.ts b/src/v2/generated/middleware.ts new file mode 100644 index 0000000..ae36e6c --- /dev/null +++ b/src/v2/generated/middleware.ts @@ -0,0 +1,66 @@ +import {RequestContext, ResponseContext} from './http/http.ts'; +import { Observable, from } from './rxjsStub.ts'; + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface Middleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Observable; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Observable; +} + +export class PromiseMiddlewareWrapper implements Middleware { + + public constructor(private middleware: PromiseMiddleware) { + + } + + pre(context: RequestContext): Observable { + return from(this.middleware.pre(context)); + } + + post(context: ResponseContext): Observable { + return from(this.middleware.post(context)); + } + +} + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface PromiseMiddleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Promise; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Promise; +} diff --git a/src/v2/generated/models/Attendee.ts b/src/v2/generated/models/Attendee.ts new file mode 100644 index 0000000..9aaa3ad --- /dev/null +++ b/src/v2/generated/models/Attendee.ts @@ -0,0 +1,47 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PersonData } from '../models/PersonData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class Attendee { + /** + * The email addresses of the attendee + */ + 'emailAddress': string | null; + 'person': PersonData | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "emailAddress", + "baseName": "emailAddress", + "type": "string", + "format": "email" + }, + { + "name": "person", + "baseName": "person", + "type": "PersonData", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Attendee.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/AuthenticationError.ts b/src/v2/generated/models/AuthenticationError.ts new file mode 100644 index 0000000..b9e388b --- /dev/null +++ b/src/v2/generated/models/AuthenticationError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class AuthenticationError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AuthenticationError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/AuthenticationErrors.ts b/src/v2/generated/models/AuthenticationErrors.ts new file mode 100644 index 0000000..9ed0150 --- /dev/null +++ b/src/v2/generated/models/AuthenticationErrors.ts @@ -0,0 +1,43 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* AuthenticationErrors model +*/ +export class AuthenticationErrors { + /** + * AuthenticationError errors + */ + 'errors'?: Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "errors", + "baseName": "errors", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AuthenticationErrors.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/AuthorizationError.ts b/src/v2/generated/models/AuthorizationError.ts new file mode 100644 index 0000000..6451aae --- /dev/null +++ b/src/v2/generated/models/AuthorizationError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class AuthorizationError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AuthorizationError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/AuthorizationErrors.ts b/src/v2/generated/models/AuthorizationErrors.ts new file mode 100644 index 0000000..dd3f047 --- /dev/null +++ b/src/v2/generated/models/AuthorizationErrors.ts @@ -0,0 +1,43 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* AuthorizationErrors model +*/ +export class AuthorizationErrors { + /** + * AuthorizationError errors + */ + 'errors'?: Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "errors", + "baseName": "errors", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AuthorizationErrors.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ChatMessage.ts b/src/v2/generated/models/ChatMessage.ts new file mode 100644 index 0000000..57a9e9e --- /dev/null +++ b/src/v2/generated/models/ChatMessage.ts @@ -0,0 +1,96 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PersonData } from '../models/PersonData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class ChatMessage { + /** + * The type of interaction + */ + 'type': ChatMessageTypeEnum; + /** + * The chat message\'s unique identifier + */ + 'id': number; + /** + * The direction of the chat message + */ + 'direction': ChatMessageDirectionEnum; + /** + * The time the chat message was sent + */ + 'sentAt': Date; + 'manualCreator': PersonData; + /** + * The participants of the chat + */ + 'participants': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "ChatMessageTypeEnum", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "direction", + "baseName": "direction", + "type": "ChatMessageDirectionEnum", + "format": "" + }, + { + "name": "sentAt", + "baseName": "sentAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "manualCreator", + "baseName": "manualCreator", + "type": "PersonData", + "format": "" + }, + { + "name": "participants", + "baseName": "participants", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ChatMessage.attributeTypeMap; + } + + public constructor() { + } +} + +export enum ChatMessageTypeEnum { + ChatMessage = 'chat-message' +} +export enum ChatMessageDirectionEnum { + Received = 'received', + Sent = 'sent' +} + diff --git a/src/v2/generated/models/CompaniesValue.ts b/src/v2/generated/models/CompaniesValue.ts new file mode 100644 index 0000000..3bb94f7 --- /dev/null +++ b/src/v2/generated/models/CompaniesValue.ts @@ -0,0 +1,55 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CompanyData } from '../models/CompanyData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class CompaniesValue { + /** + * The type of value + */ + 'type': CompaniesValueTypeEnum; + /** + * The values for many companies + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "CompaniesValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CompaniesValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum CompaniesValueTypeEnum { + CompanyMulti = 'company-multi' +} + diff --git a/src/v2/generated/models/Company.ts b/src/v2/generated/models/Company.ts new file mode 100644 index 0000000..729450b --- /dev/null +++ b/src/v2/generated/models/Company.ts @@ -0,0 +1,93 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Field } from '../models/Field.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* Company model +*/ +export class Company { + /** + * The company\'s unique identifier + */ + 'id': number; + /** + * The company\'s name + */ + 'name': string; + /** + * The company\'s primary domain + */ + 'domain': string; + /** + * All of the company\'s domains + */ + 'domains': Array; + /** + * Whether or not the company is org specific + */ + 'isGlobal': boolean; + /** + * The fields associated with the company + */ + 'fields'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "domain", + "baseName": "domain", + "type": "string", + "format": "hostname" + }, + { + "name": "domains", + "baseName": "domains", + "type": "Array", + "format": "hostname" + }, + { + "name": "isGlobal", + "baseName": "isGlobal", + "type": "boolean", + "format": "" + }, + { + "name": "fields", + "baseName": "fields", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Company.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/CompanyData.ts b/src/v2/generated/models/CompanyData.ts new file mode 100644 index 0000000..9963028 --- /dev/null +++ b/src/v2/generated/models/CompanyData.ts @@ -0,0 +1,59 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class CompanyData { + /** + * The company\'s unique identifier + */ + 'id': number; + /** + * The company\'s name + */ + 'name': string; + /** + * The company\'s primary domain + */ + 'domain': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "domain", + "baseName": "domain", + "type": "string", + "format": "hostname" + } ]; + + static getAttributeTypeMap() { + return CompanyData.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/CompanyListEntry.ts b/src/v2/generated/models/CompanyListEntry.ts new file mode 100644 index 0000000..b73ef76 --- /dev/null +++ b/src/v2/generated/models/CompanyListEntry.ts @@ -0,0 +1,82 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Company } from '../models/Company.ts'; +import { HttpFile } from '../http/http.ts'; + +export class CompanyListEntry { + /** + * The list entry\'s unique identifier + */ + 'id': number; + /** + * The entity type for this list entry + */ + 'type': CompanyListEntryTypeEnum; + /** + * The date that the list entry was created + */ + 'createdAt': Date; + /** + * The ID of the user that created this list entry + */ + 'creatorId': number | null; + 'entity': Company; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "type", + "baseName": "type", + "type": "CompanyListEntryTypeEnum", + "format": "" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "entity", + "baseName": "entity", + "type": "Company", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CompanyListEntry.attributeTypeMap; + } + + public constructor() { + } +} + +export enum CompanyListEntryTypeEnum { + Company = 'company' +} + diff --git a/src/v2/generated/models/CompanyPaged.ts b/src/v2/generated/models/CompanyPaged.ts new file mode 100644 index 0000000..53d6640 --- /dev/null +++ b/src/v2/generated/models/CompanyPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Company } from '../models/Company.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* CompanyPaged model +*/ +export class CompanyPaged { + /** + * A page of Company results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CompanyPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/CompanyValue.ts b/src/v2/generated/models/CompanyValue.ts new file mode 100644 index 0000000..da6ae9a --- /dev/null +++ b/src/v2/generated/models/CompanyValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CompanyData } from '../models/CompanyData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class CompanyValue { + /** + * The type of value + */ + 'type': CompanyValueTypeEnum; + 'data': CompanyData | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "CompanyValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "CompanyData", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CompanyValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum CompanyValueTypeEnum { + Company = 'company' +} + diff --git a/src/v2/generated/models/ConflictError.ts b/src/v2/generated/models/ConflictError.ts new file mode 100644 index 0000000..2113fe6 --- /dev/null +++ b/src/v2/generated/models/ConflictError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class ConflictError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ConflictError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/DateValue.ts b/src/v2/generated/models/DateValue.ts new file mode 100644 index 0000000..b9e6545 --- /dev/null +++ b/src/v2/generated/models/DateValue.ts @@ -0,0 +1,54 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class DateValue { + /** + * The type of value + */ + 'type': DateValueTypeEnum; + /** + * The value for a date + */ + 'data': Date | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "DateValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return DateValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum DateValueTypeEnum { + Datetime = 'datetime' +} + diff --git a/src/v2/generated/models/Dropdown.ts b/src/v2/generated/models/Dropdown.ts new file mode 100644 index 0000000..447983b --- /dev/null +++ b/src/v2/generated/models/Dropdown.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Dropdown { + /** + * Dropdown item\'s unique identifier + */ + 'dropdownOptionId': number; + /** + * Dropdown item text + */ + 'text': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "dropdownOptionId", + "baseName": "dropdownOptionId", + "type": "number", + "format": "int64" + }, + { + "name": "text", + "baseName": "text", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Dropdown.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/DropdownValue.ts b/src/v2/generated/models/DropdownValue.ts new file mode 100644 index 0000000..d46cf48 --- /dev/null +++ b/src/v2/generated/models/DropdownValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Dropdown } from '../models/Dropdown.ts'; +import { HttpFile } from '../http/http.ts'; + +export class DropdownValue { + /** + * The type of value + */ + 'type': DropdownValueTypeEnum; + 'data': Dropdown | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "DropdownValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Dropdown", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DropdownValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum DropdownValueTypeEnum { + Dropdown = 'dropdown' +} + diff --git a/src/v2/generated/models/DropdownsValue.ts b/src/v2/generated/models/DropdownsValue.ts new file mode 100644 index 0000000..2430f5e --- /dev/null +++ b/src/v2/generated/models/DropdownsValue.ts @@ -0,0 +1,55 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Dropdown } from '../models/Dropdown.ts'; +import { HttpFile } from '../http/http.ts'; + +export class DropdownsValue { + /** + * The type of value + */ + 'type': DropdownsValueTypeEnum; + /** + * The value for many dropdown items + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "DropdownsValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DropdownsValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum DropdownsValueTypeEnum { + DropdownMulti = 'dropdown-multi' +} + diff --git a/src/v2/generated/models/Email.ts b/src/v2/generated/models/Email.ts new file mode 100644 index 0000000..bacc6ac --- /dev/null +++ b/src/v2/generated/models/Email.ts @@ -0,0 +1,102 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Attendee } from '../models/Attendee.ts'; +import { HttpFile } from '../http/http.ts'; + +export class Email { + /** + * The type of interaction + */ + 'type': EmailTypeEnum; + /** + * The email\'s unique identifier + */ + 'id': number; + /** + * The subject of the email + */ + 'subject': string | null; + /** + * The time the email was sent + */ + 'sentAt': Date; + '_from': Attendee; + /** + * The recipients of the email + */ + 'to': Array; + /** + * The cc recipients of the email + */ + 'cc': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "EmailTypeEnum", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "subject", + "baseName": "subject", + "type": "string", + "format": "" + }, + { + "name": "sentAt", + "baseName": "sentAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "_from", + "baseName": "from", + "type": "Attendee", + "format": "" + }, + { + "name": "to", + "baseName": "to", + "type": "Array", + "format": "" + }, + { + "name": "cc", + "baseName": "cc", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Email.attributeTypeMap; + } + + public constructor() { + } +} + +export enum EmailTypeEnum { + Email = 'email' +} + diff --git a/src/v2/generated/models/EmptyMessageBodyError.ts b/src/v2/generated/models/EmptyMessageBodyError.ts new file mode 100644 index 0000000..f908260 --- /dev/null +++ b/src/v2/generated/models/EmptyMessageBodyError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class EmptyMessageBodyError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EmptyMessageBodyError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Errors.ts b/src/v2/generated/models/Errors.ts new file mode 100644 index 0000000..dd05ff9 --- /dev/null +++ b/src/v2/generated/models/Errors.ts @@ -0,0 +1,39 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Errors { + /** + * Errors + */ + 'errors'?: Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "errors", + "baseName": "errors", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Errors.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Field.ts b/src/v2/generated/models/Field.ts new file mode 100644 index 0000000..616f308 --- /dev/null +++ b/src/v2/generated/models/Field.ts @@ -0,0 +1,89 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { FieldValue } from '../models/FieldValue.ts'; +import { HttpFile } from '../http/http.ts'; + +export class Field { + /** + * The field\'s unique identifier + */ + 'id': string; + /** + * The field\'s name + */ + 'name': string; + /** + * The field\'s type + */ + 'type': FieldTypeEnum; + /** + * The source of the data in this Field (if it is enriched) + */ + 'enrichmentSource': FieldEnrichmentSourceEnum | null; + 'value': FieldValue; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "FieldTypeEnum", + "format": "" + }, + { + "name": "enrichmentSource", + "baseName": "enrichmentSource", + "type": "FieldEnrichmentSourceEnum", + "format": "" + }, + { + "name": "value", + "baseName": "value", + "type": "FieldValue", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Field.attributeTypeMap; + } + + public constructor() { + } +} + +export enum FieldTypeEnum { + Enriched = 'enriched', + Global = 'global', + List = 'list', + RelationshipIntelligence = 'relationship-intelligence' +} +export enum FieldEnrichmentSourceEnum { + AffinityData = 'affinity-data', + Dealroom = 'dealroom' +} + diff --git a/src/v2/generated/models/FieldMetadata.ts b/src/v2/generated/models/FieldMetadata.ts new file mode 100644 index 0000000..5b14f0d --- /dev/null +++ b/src/v2/generated/models/FieldMetadata.ts @@ -0,0 +1,110 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class FieldMetadata { + /** + * The field\'s unique identifier + */ + 'id': string; + /** + * The field\'s name + */ + 'name': string; + /** + * The field\'s type + */ + 'type': FieldMetadataTypeEnum; + /** + * The source of the data in this Field (if it is enriched) + */ + 'enrichmentSource': FieldMetadataEnrichmentSourceEnum | null; + /** + * The type of the data in this Field + */ + 'valueType': FieldMetadataValueTypeEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "FieldMetadataTypeEnum", + "format": "" + }, + { + "name": "enrichmentSource", + "baseName": "enrichmentSource", + "type": "FieldMetadataEnrichmentSourceEnum", + "format": "" + }, + { + "name": "valueType", + "baseName": "valueType", + "type": "FieldMetadataValueTypeEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FieldMetadata.attributeTypeMap; + } + + public constructor() { + } +} + +export enum FieldMetadataTypeEnum { + Enriched = 'enriched', + Global = 'global', + List = 'list', + RelationshipIntelligence = 'relationship-intelligence' +} +export enum FieldMetadataEnrichmentSourceEnum { + AffinityData = 'affinity-data', + Dealroom = 'dealroom' +} +export enum FieldMetadataValueTypeEnum { + Person = 'person', + PersonMulti = 'person-multi', + Company = 'company', + CompanyMulti = 'company-multi', + FilterableText = 'filterable-text', + FilterableTextMulti = 'filterable-text-multi', + Number = 'number', + NumberMulti = 'number-multi', + Datetime = 'datetime', + Location = 'location', + LocationMulti = 'location-multi', + Text = 'text', + RankedDropdown = 'ranked-dropdown', + Dropdown = 'dropdown', + DropdownMulti = 'dropdown-multi', + FormulaNumber = 'formula-number', + Interaction = 'interaction' +} + diff --git a/src/v2/generated/models/FieldMetadataPaged.ts b/src/v2/generated/models/FieldMetadataPaged.ts new file mode 100644 index 0000000..267ae31 --- /dev/null +++ b/src/v2/generated/models/FieldMetadataPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { FieldMetadata } from '../models/FieldMetadata.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* FieldMetadataPaged model +*/ +export class FieldMetadataPaged { + /** + * A page of FieldMetadata results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FieldMetadataPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/FieldValue.ts b/src/v2/generated/models/FieldValue.ts new file mode 100644 index 0000000..3a3a9ca --- /dev/null +++ b/src/v2/generated/models/FieldValue.ts @@ -0,0 +1,79 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CompaniesValue } from '../models/CompaniesValue.ts'; +import { CompanyValue } from '../models/CompanyValue.ts'; +import { DateValue } from '../models/DateValue.ts'; +import { DropdownValue } from '../models/DropdownValue.ts'; +import { DropdownsValue } from '../models/DropdownsValue.ts'; +import { FloatValue } from '../models/FloatValue.ts'; +import { FloatsValue } from '../models/FloatsValue.ts'; +import { FormulaValue } from '../models/FormulaValue.ts'; +import { InteractionValue } from '../models/InteractionValue.ts'; +import { LocationValue } from '../models/LocationValue.ts'; +import { LocationsValue } from '../models/LocationsValue.ts'; +import { PersonValue } from '../models/PersonValue.ts'; +import { PersonsValue } from '../models/PersonsValue.ts'; +import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; +import { TextValue } from '../models/TextValue.ts'; +import { TextsValue } from '../models/TextsValue.ts'; +import { HttpFile } from '../http/http.ts'; + +/** + * @type FieldValue + * Type + * @export + */ +export type FieldValue = CompaniesValue | CompanyValue | DateValue | DropdownValue | DropdownsValue | FloatValue | FloatsValue | FormulaValue | InteractionValue | LocationValue | LocationsValue | PersonValue | PersonsValue | RankedDropdownValue | TextValue | TextsValue; + +/** +* @type FieldValueClass +* @export +*/ +export class FieldValueClass { + static readonly discriminator: string | undefined = "type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "company": "CompanyValue", + "company-multi": "CompaniesValue", + "datetime": "DateValue", + "dropdown": "DropdownValue", + "dropdown-multi": "DropdownsValue", + "filterable-text": "TextValue", + "filterable-text-multi": "TextsValue", + "formula-number": "FormulaValue", + "interaction": "InteractionValue", + "location": "LocationValue", + "location-multi": "LocationsValue", + "number": "FloatValue", + "number-multi": "FloatsValue", + "person": "PersonValue", + "person-multi": "PersonsValue", + "ranked-dropdown": "RankedDropdownValue", + "text": "TextValue", + }; +} + + + + + + + + + + + + + + + diff --git a/src/v2/generated/models/FloatValue.ts b/src/v2/generated/models/FloatValue.ts new file mode 100644 index 0000000..d3be36e --- /dev/null +++ b/src/v2/generated/models/FloatValue.ts @@ -0,0 +1,54 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class FloatValue { + /** + * The type of value + */ + 'type': FloatValueTypeEnum; + /** + * The value for a number + */ + 'data': number | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "FloatValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FloatValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum FloatValueTypeEnum { + Number = 'number' +} + diff --git a/src/v2/generated/models/FloatsValue.ts b/src/v2/generated/models/FloatsValue.ts new file mode 100644 index 0000000..8c2d9c7 --- /dev/null +++ b/src/v2/generated/models/FloatsValue.ts @@ -0,0 +1,54 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class FloatsValue { + /** + * The type of value + */ + 'type': FloatsValueTypeEnum; + /** + * The value for many numbers + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "FloatsValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FloatsValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum FloatsValueTypeEnum { + NumberMulti = 'number-multi' +} + diff --git a/src/v2/generated/models/FormulaNumber.ts b/src/v2/generated/models/FormulaNumber.ts new file mode 100644 index 0000000..02730b0 --- /dev/null +++ b/src/v2/generated/models/FormulaNumber.ts @@ -0,0 +1,39 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class FormulaNumber { + /** + * Calculated value + */ + 'calculatedValue'?: number | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "calculatedValue", + "baseName": "calculatedValue", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FormulaNumber.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/FormulaValue.ts b/src/v2/generated/models/FormulaValue.ts new file mode 100644 index 0000000..02a114b --- /dev/null +++ b/src/v2/generated/models/FormulaValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { FormulaNumber } from '../models/FormulaNumber.ts'; +import { HttpFile } from '../http/http.ts'; + +export class FormulaValue { + /** + * The type of value + */ + 'type': FormulaValueTypeEnum; + 'data': FormulaNumber | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "FormulaValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "FormulaNumber", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FormulaValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum FormulaValueTypeEnum { + FormulaNumber = 'formula-number' +} + diff --git a/src/v2/generated/models/GenericError.ts b/src/v2/generated/models/GenericError.ts new file mode 100644 index 0000000..a97a70a --- /dev/null +++ b/src/v2/generated/models/GenericError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class GenericError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GenericError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Grant.ts b/src/v2/generated/models/Grant.ts new file mode 100644 index 0000000..2287cf5 --- /dev/null +++ b/src/v2/generated/models/Grant.ts @@ -0,0 +1,64 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Grant { + /** + * The type of grant used to authenticate + */ + 'type': GrantTypeEnum; + /** + * The scopes available to the current grant + */ + 'scopes': Array; + /** + * When the grant was created + */ + 'createdAt': Date; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "GrantTypeEnum", + "format": "" + }, + { + "name": "scopes", + "baseName": "scopes", + "type": "Array", + "format": "" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return Grant.attributeTypeMap; + } + + public constructor() { + } +} + +export enum GrantTypeEnum { + ApiKey = 'api-key' +} + diff --git a/src/v2/generated/models/Interaction.ts b/src/v2/generated/models/Interaction.ts new file mode 100644 index 0000000..c811b26 --- /dev/null +++ b/src/v2/generated/models/Interaction.ts @@ -0,0 +1,42 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ChatMessage } from '../models/ChatMessage.ts'; +import { Email } from '../models/Email.ts'; +import { Meeting } from '../models/Meeting.ts'; +import { PhoneCall } from '../models/PhoneCall.ts'; +import { HttpFile } from '../http/http.ts'; + +/** + * @type Interaction + * Type + * @export + */ +export type Interaction = ChatMessage | Email | Meeting | PhoneCall; + +/** +* @type InteractionClass +* @export +*/ +export class InteractionClass { + static readonly discriminator: string | undefined = "type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "call": "PhoneCall", + "chat-message": "ChatMessage", + "email": "Email", + "meeting": "Meeting", + }; +} + + + diff --git a/src/v2/generated/models/InteractionValue.ts b/src/v2/generated/models/InteractionValue.ts new file mode 100644 index 0000000..80a5cda --- /dev/null +++ b/src/v2/generated/models/InteractionValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Interaction } from '../models/Interaction.ts'; +import { HttpFile } from '../http/http.ts'; + +export class InteractionValue { + /** + * The type of value + */ + 'type': InteractionValueTypeEnum; + 'data': Interaction | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "InteractionValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Interaction", + "format": "" + } ]; + + static getAttributeTypeMap() { + return InteractionValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum InteractionValueTypeEnum { + Interaction = 'interaction' +} + diff --git a/src/v2/generated/models/InvalidAcceptHeaderError.ts b/src/v2/generated/models/InvalidAcceptHeaderError.ts new file mode 100644 index 0000000..508dde2 --- /dev/null +++ b/src/v2/generated/models/InvalidAcceptHeaderError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class InvalidAcceptHeaderError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return InvalidAcceptHeaderError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/InvalidMessageBodyError.ts b/src/v2/generated/models/InvalidMessageBodyError.ts new file mode 100644 index 0000000..c4337a2 --- /dev/null +++ b/src/v2/generated/models/InvalidMessageBodyError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class InvalidMessageBodyError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return InvalidMessageBodyError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/InvalidVersionHeaderError.ts b/src/v2/generated/models/InvalidVersionHeaderError.ts new file mode 100644 index 0000000..c0ba9d4 --- /dev/null +++ b/src/v2/generated/models/InvalidVersionHeaderError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class InvalidVersionHeaderError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return InvalidVersionHeaderError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/List.ts b/src/v2/generated/models/List.ts new file mode 100644 index 0000000..6cf2460 --- /dev/null +++ b/src/v2/generated/models/List.ts @@ -0,0 +1,79 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class List { + /** + * The unique identifier for the list + */ + 'id': number; + /** + * The name of the list + */ + 'name': string; + /** + * The ID of the user that created this list + */ + 'creatorId': number; + /** + * The ID of the user that owns this list + */ + 'ownerId': number; + /** + * Whether or not the list is public + */ + 'isPublic': boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "ownerId", + "baseName": "ownerId", + "type": "number", + "format": "int64" + }, + { + "name": "isPublic", + "baseName": "isPublic", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return List.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ListEntry.ts b/src/v2/generated/models/ListEntry.ts new file mode 100644 index 0000000..188de9f --- /dev/null +++ b/src/v2/generated/models/ListEntry.ts @@ -0,0 +1,80 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Field } from '../models/Field.ts'; +import { HttpFile } from '../http/http.ts'; + +export class ListEntry { + /** + * The list entry\'s unique identifier + */ + 'id': number; + /** + * The ID of the list that this list entry belongs to + */ + 'listId': number; + /** + * The date that the list entry was created + */ + 'createdAt': Date; + /** + * The ID of the user that created this list entry + */ + 'creatorId': number | null; + /** + * The fields associated with the list entry + */ + 'fields': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "listId", + "baseName": "listId", + "type": "number", + "format": "int64" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "fields", + "baseName": "fields", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListEntry.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ListEntryPaged.ts b/src/v2/generated/models/ListEntryPaged.ts new file mode 100644 index 0000000..8c5aa84 --- /dev/null +++ b/src/v2/generated/models/ListEntryPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ListEntry } from '../models/ListEntry.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* ListEntryPaged model +*/ +export class ListEntryPaged { + /** + * A page of ListEntry results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListEntryPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ListEntryWithEntity.ts b/src/v2/generated/models/ListEntryWithEntity.ts new file mode 100644 index 0000000..ab86530 --- /dev/null +++ b/src/v2/generated/models/ListEntryWithEntity.ts @@ -0,0 +1,39 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CompanyListEntry } from '../models/CompanyListEntry.ts'; +import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; +import { PersonListEntry } from '../models/PersonListEntry.ts'; +import { HttpFile } from '../http/http.ts'; + +/** + * @type ListEntryWithEntity + * Type + * @export + */ +export type ListEntryWithEntity = CompanyListEntry | OpportunityListEntry | PersonListEntry; + +/** +* @type ListEntryWithEntityClass +* @export +*/ +export class ListEntryWithEntityClass { + static readonly discriminator: string | undefined = "type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "company": "CompanyListEntry", + "opportunity": "OpportunityListEntry", + "person": "PersonListEntry", + }; +} + + diff --git a/src/v2/generated/models/ListEntryWithEntityPaged.ts b/src/v2/generated/models/ListEntryWithEntityPaged.ts new file mode 100644 index 0000000..047d58c --- /dev/null +++ b/src/v2/generated/models/ListEntryWithEntityPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* ListEntryWithEntityPaged model +*/ +export class ListEntryWithEntityPaged { + /** + * A page of ListEntryWithEntity results + */ + 'data': Array | null; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListEntryWithEntityPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ListPaged.ts b/src/v2/generated/models/ListPaged.ts new file mode 100644 index 0000000..28e21cb --- /dev/null +++ b/src/v2/generated/models/ListPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { List } from '../models/List.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* ListPaged model +*/ +export class ListPaged { + /** + * A page of List results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ListWithType.ts b/src/v2/generated/models/ListWithType.ts new file mode 100644 index 0000000..9a0b1ac --- /dev/null +++ b/src/v2/generated/models/ListWithType.ts @@ -0,0 +1,99 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +/** +* ListWithType model +*/ +export class ListWithType { + /** + * The unique identifier for the list + */ + 'id': number; + /** + * The name of the list + */ + 'name': string; + /** + * The ID of the user that created this list + */ + 'creatorId': number; + /** + * The ID of the user that owns this list + */ + 'ownerId': number; + /** + * Whether or not the list is public + */ + 'isPublic': boolean; + /** + * The entity type for this list + */ + 'type': ListWithTypeTypeEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "ownerId", + "baseName": "ownerId", + "type": "number", + "format": "int64" + }, + { + "name": "isPublic", + "baseName": "isPublic", + "type": "boolean", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "ListWithTypeTypeEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListWithType.attributeTypeMap; + } + + public constructor() { + } +} + +export enum ListWithTypeTypeEnum { + Company = 'company', + Opportunity = 'opportunity', + Person = 'person' +} + diff --git a/src/v2/generated/models/ListWithTypePaged.ts b/src/v2/generated/models/ListWithTypePaged.ts new file mode 100644 index 0000000..25d917a --- /dev/null +++ b/src/v2/generated/models/ListWithTypePaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ListWithType } from '../models/ListWithType.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* ListWithTypePaged model +*/ +export class ListWithTypePaged { + /** + * A page of ListWithType results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListWithTypePaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Location.ts b/src/v2/generated/models/Location.ts new file mode 100644 index 0000000..8a33a3d --- /dev/null +++ b/src/v2/generated/models/Location.ts @@ -0,0 +1,79 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Location { + /** + * Street address + */ + 'streetAddress': string | null; + /** + * City + */ + 'city': string | null; + /** + * State + */ + 'state': string | null; + /** + * Country + */ + 'country': string | null; + /** + * Continent + */ + 'continent': string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "streetAddress", + "baseName": "streetAddress", + "type": "string", + "format": "" + }, + { + "name": "city", + "baseName": "city", + "type": "string", + "format": "" + }, + { + "name": "state", + "baseName": "state", + "type": "string", + "format": "" + }, + { + "name": "country", + "baseName": "country", + "type": "string", + "format": "" + }, + { + "name": "continent", + "baseName": "continent", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Location.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/LocationValue.ts b/src/v2/generated/models/LocationValue.ts new file mode 100644 index 0000000..1b2276c --- /dev/null +++ b/src/v2/generated/models/LocationValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Location } from '../models/Location.ts'; +import { HttpFile } from '../http/http.ts'; + +export class LocationValue { + /** + * The type of value + */ + 'type': LocationValueTypeEnum; + 'data': Location | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "LocationValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Location", + "format": "" + } ]; + + static getAttributeTypeMap() { + return LocationValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum LocationValueTypeEnum { + Location = 'location' +} + diff --git a/src/v2/generated/models/LocationsValue.ts b/src/v2/generated/models/LocationsValue.ts new file mode 100644 index 0000000..b1f9515 --- /dev/null +++ b/src/v2/generated/models/LocationsValue.ts @@ -0,0 +1,55 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Location } from '../models/Location.ts'; +import { HttpFile } from '../http/http.ts'; + +export class LocationsValue { + /** + * The type of value + */ + 'type': LocationsValueTypeEnum; + /** + * The values for many locations + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "LocationsValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return LocationsValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum LocationsValueTypeEnum { + LocationMulti = 'location-multi' +} + diff --git a/src/v2/generated/models/Meeting.ts b/src/v2/generated/models/Meeting.ts new file mode 100644 index 0000000..5359c8a --- /dev/null +++ b/src/v2/generated/models/Meeting.ts @@ -0,0 +1,105 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Attendee } from '../models/Attendee.ts'; +import { HttpFile } from '../http/http.ts'; + +export class Meeting { + /** + * The type of interaction + */ + 'type': MeetingTypeEnum; + /** + * The meeting\'s unique identifier + */ + 'id': number; + /** + * The meeting\'s title + */ + 'title': string | null; + /** + * Whether the meeting is an all-day event + */ + 'allDay': boolean; + /** + * The meeting start time + */ + 'startTime': Date; + /** + * The meeting end time + */ + 'endTime': Date | null; + /** + * People attending the meeting + */ + 'attendees': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "MeetingTypeEnum", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "title", + "baseName": "title", + "type": "string", + "format": "" + }, + { + "name": "allDay", + "baseName": "allDay", + "type": "boolean", + "format": "" + }, + { + "name": "startTime", + "baseName": "startTime", + "type": "Date", + "format": "date-time" + }, + { + "name": "endTime", + "baseName": "endTime", + "type": "Date", + "format": "date-time" + }, + { + "name": "attendees", + "baseName": "attendees", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Meeting.attributeTypeMap; + } + + public constructor() { + } +} + +export enum MeetingTypeEnum { + Meeting = 'meeting' +} + diff --git a/src/v2/generated/models/MethodNotAllowedError.ts b/src/v2/generated/models/MethodNotAllowedError.ts new file mode 100644 index 0000000..4dd3592 --- /dev/null +++ b/src/v2/generated/models/MethodNotAllowedError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class MethodNotAllowedError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MethodNotAllowedError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ModelError.ts b/src/v2/generated/models/ModelError.ts new file mode 100644 index 0000000..592803c --- /dev/null +++ b/src/v2/generated/models/ModelError.ts @@ -0,0 +1,72 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { ConflictError } from '../models/ConflictError.ts'; +import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; +import { GenericError } from '../models/GenericError.ts'; +import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; +import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; +import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; +import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; +import { NotFoundError } from '../models/NotFoundError.ts'; +import { RateLimitError } from '../models/RateLimitError.ts'; +import { ServerError } from '../models/ServerError.ts'; +import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; +import { ValidationError } from '../models/ValidationError.ts'; +import { HttpFile } from '../http/http.ts'; + +/** + * @type ModelError + * Type + * @export + */ +export type ModelError = AuthenticationError | AuthorizationError | ConflictError | EmptyMessageBodyError | GenericError | InvalidAcceptHeaderError | InvalidMessageBodyError | InvalidVersionHeaderError | MethodNotAllowedError | NotFoundError | RateLimitError | ServerError | TooManyMultipartFilesError | ValidationError; + +/** +* @type ModelErrorClass +* @export +*/ +export class ModelErrorClass { + static readonly discriminator: string | undefined = "code"; + + static readonly mapping: {[index: string]: string} | undefined = { + "authentication": "AuthenticationError", + "authorization": "AuthorizationError", + "conflict": "ConflictError", + "empty-message-body": "EmptyMessageBodyError", + "error": "GenericError", + "invalid-accept-header": "InvalidAcceptHeaderError", + "invalid-message-body": "InvalidMessageBodyError", + "invalid-version-header": "InvalidVersionHeaderError", + "method-not-allowed": "MethodNotAllowedError", + "not-found": "NotFoundError", + "rate-limit": "RateLimitError", + "server": "ServerError", + "too-many-multipart-files": "TooManyMultipartFilesError", + "validation": "ValidationError", + }; +} + + + + + + + + + + + + + diff --git a/src/v2/generated/models/NotFoundError.ts b/src/v2/generated/models/NotFoundError.ts new file mode 100644 index 0000000..25c81ef --- /dev/null +++ b/src/v2/generated/models/NotFoundError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class NotFoundError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return NotFoundError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/NotFoundErrors.ts b/src/v2/generated/models/NotFoundErrors.ts new file mode 100644 index 0000000..3b995191 --- /dev/null +++ b/src/v2/generated/models/NotFoundErrors.ts @@ -0,0 +1,43 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { NotFoundError } from '../models/NotFoundError.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* NotFoundErrors model +*/ +export class NotFoundErrors { + /** + * NotFoundError errors + */ + 'errors'?: Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "errors", + "baseName": "errors", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return NotFoundErrors.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ObjectSerializer.ts b/src/v2/generated/models/ObjectSerializer.ts new file mode 100644 index 0000000..a7d9e8a --- /dev/null +++ b/src/v2/generated/models/ObjectSerializer.ts @@ -0,0 +1,574 @@ +export * from '../models/Attendee.ts'; +export * from '../models/AuthenticationError.ts'; +export * from '../models/AuthenticationErrors.ts'; +export * from '../models/AuthorizationError.ts'; +export * from '../models/AuthorizationErrors.ts'; +export * from '../models/ChatMessage.ts'; +export * from '../models/CompaniesValue.ts'; +export * from '../models/Company.ts'; +export * from '../models/CompanyData.ts'; +export * from '../models/CompanyListEntry.ts'; +export * from '../models/CompanyPaged.ts'; +export * from '../models/CompanyValue.ts'; +export * from '../models/ConflictError.ts'; +export * from '../models/DateValue.ts'; +export * from '../models/Dropdown.ts'; +export * from '../models/DropdownValue.ts'; +export * from '../models/DropdownsValue.ts'; +export * from '../models/Email.ts'; +export * from '../models/EmptyMessageBodyError.ts'; +export * from '../models/Errors.ts'; +export * from '../models/Field.ts'; +export * from '../models/FieldMetadata.ts'; +export * from '../models/FieldMetadataPaged.ts'; +export * from '../models/FieldValue.ts'; +export * from '../models/FloatValue.ts'; +export * from '../models/FloatsValue.ts'; +export * from '../models/FormulaNumber.ts'; +export * from '../models/FormulaValue.ts'; +export * from '../models/GenericError.ts'; +export * from '../models/Grant.ts'; +export * from '../models/Interaction.ts'; +export * from '../models/InteractionValue.ts'; +export * from '../models/InvalidAcceptHeaderError.ts'; +export * from '../models/InvalidMessageBodyError.ts'; +export * from '../models/InvalidVersionHeaderError.ts'; +export * from '../models/List.ts'; +export * from '../models/ListEntry.ts'; +export * from '../models/ListEntryPaged.ts'; +export * from '../models/ListEntryWithEntity.ts'; +export * from '../models/ListEntryWithEntityPaged.ts'; +export * from '../models/ListPaged.ts'; +export * from '../models/ListWithType.ts'; +export * from '../models/ListWithTypePaged.ts'; +export * from '../models/Location.ts'; +export * from '../models/LocationValue.ts'; +export * from '../models/LocationsValue.ts'; +export * from '../models/Meeting.ts'; +export * from '../models/MethodNotAllowedError.ts'; +export * from '../models/ModelError.ts'; +export * from '../models/NotFoundError.ts'; +export * from '../models/NotFoundErrors.ts'; +export * from '../models/Opportunity.ts'; +export * from '../models/OpportunityListEntry.ts'; +export * from '../models/OpportunityPaged.ts'; +export * from '../models/OpportunityWithFields.ts'; +export * from '../models/Pagination.ts'; +export * from '../models/Person.ts'; +export * from '../models/PersonData.ts'; +export * from '../models/PersonListEntry.ts'; +export * from '../models/PersonPaged.ts'; +export * from '../models/PersonValue.ts'; +export * from '../models/PersonsValue.ts'; +export * from '../models/PhoneCall.ts'; +export * from '../models/RankedDropdown.ts'; +export * from '../models/RankedDropdownValue.ts'; +export * from '../models/RateLimitError.ts'; +export * from '../models/SavedView.ts'; +export * from '../models/SavedViewPaged.ts'; +export * from '../models/ServerError.ts'; +export * from '../models/Tenant.ts'; +export * from '../models/TextValue.ts'; +export * from '../models/TextsValue.ts'; +export * from '../models/TooManyMultipartFilesError.ts'; +export * from '../models/User.ts'; +export * from '../models/ValidationError.ts'; +export * from '../models/ValidationErrors.ts'; +export * from '../models/WhoAmI.ts'; + +import { Attendee } from '../models/Attendee.ts'; +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { ChatMessage, ChatMessageTypeEnum , ChatMessageDirectionEnum } from '../models/ChatMessage.ts'; +import { CompaniesValue, CompaniesValueTypeEnum } from '../models/CompaniesValue.ts'; +import { Company } from '../models/Company.ts'; +import { CompanyData } from '../models/CompanyData.ts'; +import { CompanyListEntry , CompanyListEntryTypeEnum } from '../models/CompanyListEntry.ts'; +import { CompanyPaged } from '../models/CompanyPaged.ts'; +import { CompanyValue, CompanyValueTypeEnum } from '../models/CompanyValue.ts'; +import { ConflictError } from '../models/ConflictError.ts'; +import { DateValue, DateValueTypeEnum } from '../models/DateValue.ts'; +import { Dropdown } from '../models/Dropdown.ts'; +import { DropdownValue, DropdownValueTypeEnum } from '../models/DropdownValue.ts'; +import { DropdownsValue, DropdownsValueTypeEnum } from '../models/DropdownsValue.ts'; +import { Email, EmailTypeEnum } from '../models/Email.ts'; +import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; +import { Errors } from '../models/Errors.ts'; +import { Field , FieldTypeEnum , FieldEnrichmentSourceEnum } from '../models/Field.ts'; +import { FieldMetadata , FieldMetadataTypeEnum , FieldMetadataEnrichmentSourceEnum , FieldMetadataValueTypeEnum } from '../models/FieldMetadata.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { FieldValueClass } from '../models/FieldValue.ts'; +import { FloatValue, FloatValueTypeEnum } from '../models/FloatValue.ts'; +import { FloatsValue, FloatsValueTypeEnum } from '../models/FloatsValue.ts'; +import { FormulaNumber } from '../models/FormulaNumber.ts'; +import { FormulaValue, FormulaValueTypeEnum } from '../models/FormulaValue.ts'; +import { GenericError } from '../models/GenericError.ts'; +import { Grant, GrantTypeEnum } from '../models/Grant.ts'; +import { InteractionClass } from '../models/Interaction.ts'; +import { InteractionValue, InteractionValueTypeEnum } from '../models/InteractionValue.ts'; +import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; +import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; +import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; +import { List } from '../models/List.ts'; +import { ListEntry } from '../models/ListEntry.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListEntryWithEntityClass } from '../models/ListEntryWithEntity.ts'; +import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { ListWithType , ListWithTypeTypeEnum } from '../models/ListWithType.ts'; +import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; +import { Location } from '../models/Location.ts'; +import { LocationValue, LocationValueTypeEnum } from '../models/LocationValue.ts'; +import { LocationsValue, LocationsValueTypeEnum } from '../models/LocationsValue.ts'; +import { Meeting, MeetingTypeEnum } from '../models/Meeting.ts'; +import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; +import { ModelErrorClass } from '../models/ModelError.ts'; +import { NotFoundError } from '../models/NotFoundError.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Opportunity } from '../models/Opportunity.ts'; +import { OpportunityListEntry , OpportunityListEntryTypeEnum } from '../models/OpportunityListEntry.ts'; +import { OpportunityPaged } from '../models/OpportunityPaged.ts'; +import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { Person , PersonTypeEnum } from '../models/Person.ts'; +import { PersonData , PersonDataTypeEnum } from '../models/PersonData.ts'; +import { PersonListEntry , PersonListEntryTypeEnum } from '../models/PersonListEntry.ts'; +import { PersonPaged } from '../models/PersonPaged.ts'; +import { PersonValue, PersonValueTypeEnum } from '../models/PersonValue.ts'; +import { PersonsValue, PersonsValueTypeEnum } from '../models/PersonsValue.ts'; +import { PhoneCall, PhoneCallTypeEnum } from '../models/PhoneCall.ts'; +import { RankedDropdown } from '../models/RankedDropdown.ts'; +import { RankedDropdownValue, RankedDropdownValueTypeEnum } from '../models/RankedDropdownValue.ts'; +import { RateLimitError } from '../models/RateLimitError.ts'; +import { SavedView , SavedViewTypeEnum } from '../models/SavedView.ts'; +import { SavedViewPaged } from '../models/SavedViewPaged.ts'; +import { ServerError } from '../models/ServerError.ts'; +import { Tenant } from '../models/Tenant.ts'; +import { TextValue, TextValueTypeEnum } from '../models/TextValue.ts'; +import { TextsValue, TextsValueTypeEnum } from '../models/TextsValue.ts'; +import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; +import { User } from '../models/User.ts'; +import { ValidationError } from '../models/ValidationError.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; +import { WhoAmI } from '../models/WhoAmI.ts'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: Set = new Set([ + "ChatMessageTypeEnum", + "ChatMessageDirectionEnum", + "CompaniesValueTypeEnum", + "CompanyListEntryTypeEnum", + "CompanyValueTypeEnum", + "DateValueTypeEnum", + "DropdownValueTypeEnum", + "DropdownsValueTypeEnum", + "EmailTypeEnum", + "FieldTypeEnum", + "FieldEnrichmentSourceEnum", + "FieldMetadataTypeEnum", + "FieldMetadataEnrichmentSourceEnum", + "FieldMetadataValueTypeEnum", + "FieldValueTypeEnum", + "FloatValueTypeEnum", + "FloatsValueTypeEnum", + "FormulaValueTypeEnum", + "GrantTypeEnum", + "InteractionTypeEnum", + "InteractionDirectionEnum", + "InteractionValueTypeEnum", + "ListEntryWithEntityTypeEnum", + "ListWithTypeTypeEnum", + "LocationValueTypeEnum", + "LocationsValueTypeEnum", + "MeetingTypeEnum", + "OpportunityListEntryTypeEnum", + "PersonTypeEnum", + "PersonDataTypeEnum", + "PersonListEntryTypeEnum", + "PersonValueTypeEnum", + "PersonsValueTypeEnum", + "PhoneCallTypeEnum", + "RankedDropdownValueTypeEnum", + "SavedViewTypeEnum", + "TextValueTypeEnum", + "TextsValueTypeEnum", +]); + +let typeMap: {[index: string]: any} = { + "Attendee": Attendee, + "AuthenticationError": AuthenticationError, + "AuthenticationErrors": AuthenticationErrors, + "AuthorizationError": AuthorizationError, + "AuthorizationErrors": AuthorizationErrors, + "ChatMessage": ChatMessage, + "CompaniesValue": CompaniesValue, + "Company": Company, + "CompanyData": CompanyData, + "CompanyListEntry": CompanyListEntry, + "CompanyPaged": CompanyPaged, + "CompanyValue": CompanyValue, + "ConflictError": ConflictError, + "DateValue": DateValue, + "Dropdown": Dropdown, + "DropdownValue": DropdownValue, + "DropdownsValue": DropdownsValue, + "Email": Email, + "EmptyMessageBodyError": EmptyMessageBodyError, + "Errors": Errors, + "Field": Field, + "FieldMetadata": FieldMetadata, + "FieldMetadataPaged": FieldMetadataPaged, + "FieldValue": FieldValueClass, + "FloatValue": FloatValue, + "FloatsValue": FloatsValue, + "FormulaNumber": FormulaNumber, + "FormulaValue": FormulaValue, + "GenericError": GenericError, + "Grant": Grant, + "Interaction": InteractionClass, + "InteractionValue": InteractionValue, + "InvalidAcceptHeaderError": InvalidAcceptHeaderError, + "InvalidMessageBodyError": InvalidMessageBodyError, + "InvalidVersionHeaderError": InvalidVersionHeaderError, + "List": List, + "ListEntry": ListEntry, + "ListEntryPaged": ListEntryPaged, + "ListEntryWithEntity": ListEntryWithEntityClass, + "ListEntryWithEntityPaged": ListEntryWithEntityPaged, + "ListPaged": ListPaged, + "ListWithType": ListWithType, + "ListWithTypePaged": ListWithTypePaged, + "Location": Location, + "LocationValue": LocationValue, + "LocationsValue": LocationsValue, + "Meeting": Meeting, + "MethodNotAllowedError": MethodNotAllowedError, + "ModelError": ModelErrorClass, + "NotFoundError": NotFoundError, + "NotFoundErrors": NotFoundErrors, + "Opportunity": Opportunity, + "OpportunityListEntry": OpportunityListEntry, + "OpportunityPaged": OpportunityPaged, + "OpportunityWithFields": OpportunityWithFields, + "Pagination": Pagination, + "Person": Person, + "PersonData": PersonData, + "PersonListEntry": PersonListEntry, + "PersonPaged": PersonPaged, + "PersonValue": PersonValue, + "PersonsValue": PersonsValue, + "PhoneCall": PhoneCall, + "RankedDropdown": RankedDropdown, + "RankedDropdownValue": RankedDropdownValue, + "RateLimitError": RateLimitError, + "SavedView": SavedView, + "SavedViewPaged": SavedViewPaged, + "ServerError": ServerError, + "Tenant": Tenant, + "TextValue": TextValue, + "TextsValue": TextsValue, + "TooManyMultipartFilesError": TooManyMultipartFilesError, + "User": User, + "ValidationError": ValidationError, + "ValidationErrors": ValidationErrors, + "WhoAmI": WhoAmI, +} + +type MimeTypeDescriptor = { + type: string; + subtype: string; + subtypeTokens: string[]; +}; + +/** + * Every mime-type consists of a type, subtype, and optional parameters. + * The subtype can be composite, including information about the content format. + * For example: `application/json-patch+json`, `application/merge-patch+json`. + * + * This helper transforms a string mime-type into an internal representation. + * This simplifies the implementation of predicates that in turn define common rules for parsing or stringifying + * the payload. + */ +const parseMimeType = (mimeType: string): MimeTypeDescriptor => { + const [type, subtype] = mimeType.split('/'); + return { + type, + subtype, + subtypeTokens: subtype.split('+'), + }; +}; + +type MimeTypePredicate = (mimeType: string) => boolean; + +// This factory creates a predicate function that checks a string mime-type against defined rules. +const mimeTypePredicateFactory = (predicate: (descriptor: MimeTypeDescriptor) => boolean): MimeTypePredicate => (mimeType) => predicate(parseMimeType(mimeType)); + +// Use this factory when you need to define a simple predicate based only on type and, if applicable, subtype. +const mimeTypeSimplePredicateFactory = (type: string, subtype?: string): MimeTypePredicate => mimeTypePredicateFactory((descriptor) => { + if (descriptor.type !== type) return false; + if (subtype != null && descriptor.subtype !== subtype) return false; + return true; +}); + +// Creating a set of named predicates that will help us determine how to handle different mime-types +const isTextLikeMimeType = mimeTypeSimplePredicateFactory('text'); +const isJsonMimeType = mimeTypeSimplePredicateFactory('application', 'json'); +const isJsonLikeMimeType = mimeTypePredicateFactory((descriptor) => descriptor.type === 'application' && descriptor.subtypeTokens.some((item) => item === 'json')); +const isOctetStreamMimeType = mimeTypeSimplePredicateFactory('application', 'octet-stream'); +const isFormUrlencodedMimeType = mimeTypeSimplePredicateFactory('application', 'x-www-form-urlencoded'); + +// Defining a list of mime-types in the order of prioritization for handling. +const supportedMimeTypePredicatesWithPriority: MimeTypePredicate[] = [ + isJsonMimeType, + isJsonLikeMimeType, + isTextLikeMimeType, + isOctetStreamMimeType, + isFormUrlencodedMimeType, +]; + +const nullableSuffix = " | null"; +const optionalSuffix = " | undefined"; +const arrayPrefix = "Array<"; +const arraySuffix = ">"; +const mapPrefix = "{ [key: string]: "; +const mapSuffix = "; }"; + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap.has(expectedType)) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + let mapping = typeMap[expectedType].mapping; + if (mapping != undefined && mapping[discriminatorType]) { + return mapping[discriminatorType]; // use the type given in the discriminator + } else if(typeMap[discriminatorType]) { + return discriminatorType; + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string, format: string): any { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.endsWith(nullableSuffix)) { + let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type + return ObjectSerializer.serialize(data, subType, format); + } else if (type.endsWith(optionalSuffix)) { + let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type + return ObjectSerializer.serialize(data, subType, format); + } else if (type.startsWith(arrayPrefix)) { + let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.serialize(date, subType, format)); + } + return transformedData; + } else if (type.startsWith(mapPrefix)) { + let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type + let transformedData: { [key: string]: any } = {}; + for (let key in data) { + transformedData[key] = ObjectSerializer.serialize( + data[key], + subType, + format, + ); + } + return transformedData; + } else if (type === "Date") { + if (format == "date") { + let month = data.getMonth()+1 + month = month < 10 ? "0" + month.toString() : month.toString() + let day = data.getDate(); + day = day < 10 ? "0" + day.toString() : day.toString(); + + return data.getFullYear() + "-" + month + "-" + day; + } else { + return data.toISOString(); + } + } else { + if (enumsMap.has(type)) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let attributeType of attributeTypes) { + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + } + return instance; + } + } + + public static deserialize(data: any, type: string, format: string): any { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.endsWith(nullableSuffix)) { + let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type + return ObjectSerializer.deserialize(data, subType, format); + } else if (type.endsWith(optionalSuffix)) { + let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type + return ObjectSerializer.deserialize(data, subType, format); + } else if (type.startsWith(arrayPrefix)) { + let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.deserialize(date, subType, format)); + } + return transformedData; + } else if (type.startsWith(mapPrefix)) { + let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type + let transformedData: { [key: string]: any } = {}; + for (let key in data) { + transformedData[key] = ObjectSerializer.deserialize( + data[key], + subType, + format, + ); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap.has(type)) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let attributeType of attributeTypes) { + let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); + if (value !== undefined) { + instance[attributeType.name] = value; + } + } + return instance; + } + } + + + /** + * Normalize media type + * + * We currently do not handle any media types attributes, i.e. anything + * after a semicolon. All content is assumed to be UTF-8 compatible. + */ + public static normalizeMediaType(mediaType: string | undefined): string | undefined { + if (mediaType === undefined) { + return undefined; + } + return mediaType.split(";")[0].trim().toLowerCase(); + } + + /** + * From a list of possible media types, choose the one we can handle best. + * + * The order of the given media types does not have any impact on the choice + * made. + */ + public static getPreferredMediaType(mediaTypes: Array): string { + /** According to OAS 3 we should default to json */ + if (mediaTypes.length === 0) { + return "application/json"; + } + + const normalMediaTypes = mediaTypes.map(this.normalizeMediaType); + + for (const predicate of supportedMimeTypePredicatesWithPriority) { + for (const mediaType of normalMediaTypes) { + if (mediaType != null && predicate(mediaType)) { + return mediaType; + } + } + } + + throw new Error("None of the given media types are supported: " + mediaTypes.join(", ")); + } + + /** + * Convert data to a string according the given media type + */ + public static stringify(data: any, mediaType: string): string { + if (isTextLikeMimeType(mediaType)) { + return String(data); + } + + if (isJsonLikeMimeType(mediaType)) { + return JSON.stringify(data); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify."); + } + + /** + * Parse data from a string according to the given media type + */ + public static parse(rawData: string, mediaType: string | undefined) { + if (mediaType === undefined) { + throw new Error("Cannot parse content. No Content-Type defined."); + } + + if (isTextLikeMimeType(mediaType)) { + return rawData; + } + + if (isJsonLikeMimeType(mediaType)) { + return JSON.parse(rawData); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse."); + } +} diff --git a/src/v2/generated/models/Opportunity.ts b/src/v2/generated/models/Opportunity.ts new file mode 100644 index 0000000..cad6782 --- /dev/null +++ b/src/v2/generated/models/Opportunity.ts @@ -0,0 +1,62 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +/** +* Opportunity model +*/ +export class Opportunity { + /** + * The unique identifier for the opportunity + */ + 'id': number; + /** + * The name of the opportunity + */ + 'name': string; + /** + * The ID of the list that the opportunity belongs to + */ + 'listId': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "listId", + "baseName": "listId", + "type": "number", + "format": "int64" + } ]; + + static getAttributeTypeMap() { + return Opportunity.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/OpportunityListEntry.ts b/src/v2/generated/models/OpportunityListEntry.ts new file mode 100644 index 0000000..14f01d1 --- /dev/null +++ b/src/v2/generated/models/OpportunityListEntry.ts @@ -0,0 +1,82 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; +import { HttpFile } from '../http/http.ts'; + +export class OpportunityListEntry { + /** + * The list entry\'s unique identifier + */ + 'id': number; + /** + * The entity type for this list entry + */ + 'type': OpportunityListEntryTypeEnum; + /** + * The date that the list entry was created + */ + 'createdAt': Date; + /** + * The ID of the user that created this list entry + */ + 'creatorId': number | null; + 'entity': OpportunityWithFields; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "type", + "baseName": "type", + "type": "OpportunityListEntryTypeEnum", + "format": "" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "entity", + "baseName": "entity", + "type": "OpportunityWithFields", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OpportunityListEntry.attributeTypeMap; + } + + public constructor() { + } +} + +export enum OpportunityListEntryTypeEnum { + Opportunity = 'opportunity' +} + diff --git a/src/v2/generated/models/OpportunityPaged.ts b/src/v2/generated/models/OpportunityPaged.ts new file mode 100644 index 0000000..58e0cc3 --- /dev/null +++ b/src/v2/generated/models/OpportunityPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Opportunity } from '../models/Opportunity.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* OpportunityPaged model +*/ +export class OpportunityPaged { + /** + * A page of Opportunity results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OpportunityPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/OpportunityWithFields.ts b/src/v2/generated/models/OpportunityWithFields.ts new file mode 100644 index 0000000..31d8abc --- /dev/null +++ b/src/v2/generated/models/OpportunityWithFields.ts @@ -0,0 +1,70 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Field } from '../models/Field.ts'; +import { HttpFile } from '../http/http.ts'; + +export class OpportunityWithFields { + /** + * The unique identifier for the opportunity + */ + 'id': number; + /** + * The name of the opportunity + */ + 'name': string; + /** + * The ID of the list that the opportunity belongs to + */ + 'listId': number; + /** + * The fields associated with the opportunity + */ + 'fields'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "listId", + "baseName": "listId", + "type": "number", + "format": "int64" + }, + { + "name": "fields", + "baseName": "fields", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OpportunityWithFields.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Pagination.ts b/src/v2/generated/models/Pagination.ts new file mode 100644 index 0000000..0f63a82 --- /dev/null +++ b/src/v2/generated/models/Pagination.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Pagination { + /** + * URL for the previous page + */ + 'prevUrl'?: string | null; + /** + * URL for the next page + */ + 'nextUrl'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "prevUrl", + "baseName": "prevUrl", + "type": "string", + "format": "url" + }, + { + "name": "nextUrl", + "baseName": "nextUrl", + "type": "string", + "format": "url" + } ]; + + static getAttributeTypeMap() { + return Pagination.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Person.ts b/src/v2/generated/models/Person.ts new file mode 100644 index 0000000..587cf82 --- /dev/null +++ b/src/v2/generated/models/Person.ts @@ -0,0 +1,109 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Field } from '../models/Field.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* Person model +*/ +export class Person { + /** + * The persons\'s unique identifier + */ + 'id': number; + /** + * The person\'s first name + */ + 'firstName': string; + /** + * The person\'s last name + */ + 'lastName': string | null; + /** + * The person\'s primary email address + */ + 'primaryEmailAddress': string | null; + /** + * All of the person\'s email addresses + */ + 'emailAddresses': Array; + /** + * The person\'s type + */ + 'type': PersonTypeEnum; + /** + * The fields associated with the person + */ + 'fields'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string", + "format": "" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string", + "format": "" + }, + { + "name": "primaryEmailAddress", + "baseName": "primaryEmailAddress", + "type": "string", + "format": "email" + }, + { + "name": "emailAddresses", + "baseName": "emailAddresses", + "type": "Array", + "format": "email" + }, + { + "name": "type", + "baseName": "type", + "type": "PersonTypeEnum", + "format": "" + }, + { + "name": "fields", + "baseName": "fields", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Person.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PersonTypeEnum { + Internal = 'internal', + External = 'external' +} + diff --git a/src/v2/generated/models/PersonData.ts b/src/v2/generated/models/PersonData.ts new file mode 100644 index 0000000..81f8c26 --- /dev/null +++ b/src/v2/generated/models/PersonData.ts @@ -0,0 +1,86 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class PersonData { + /** + * The persons\'s unique identifier + */ + 'id': number; + /** + * The person\'s first name + */ + 'firstName': string | null; + /** + * The person\'s last name + */ + 'lastName': string | null; + /** + * The person\'s primary email address + */ + 'primaryEmailAddress': string | null; + /** + * The person\'s type + */ + 'type': PersonDataTypeEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string", + "format": "" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string", + "format": "" + }, + { + "name": "primaryEmailAddress", + "baseName": "primaryEmailAddress", + "type": "string", + "format": "email" + }, + { + "name": "type", + "baseName": "type", + "type": "PersonDataTypeEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PersonData.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PersonDataTypeEnum { + Internal = 'internal', + External = 'external', + Collaborator = 'collaborator' +} + diff --git a/src/v2/generated/models/PersonListEntry.ts b/src/v2/generated/models/PersonListEntry.ts new file mode 100644 index 0000000..f9281e3 --- /dev/null +++ b/src/v2/generated/models/PersonListEntry.ts @@ -0,0 +1,82 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Person } from '../models/Person.ts'; +import { HttpFile } from '../http/http.ts'; + +export class PersonListEntry { + /** + * The list entry\'s unique identifier + */ + 'id': number; + /** + * The entity type for this list entry + */ + 'type': PersonListEntryTypeEnum; + /** + * The date that the list entry was created + */ + 'createdAt': Date; + /** + * The ID of the user that created this list entry + */ + 'creatorId': number | null; + 'entity': Person; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "type", + "baseName": "type", + "type": "PersonListEntryTypeEnum", + "format": "" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + }, + { + "name": "creatorId", + "baseName": "creatorId", + "type": "number", + "format": "int64" + }, + { + "name": "entity", + "baseName": "entity", + "type": "Person", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PersonListEntry.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PersonListEntryTypeEnum { + Person = 'person' +} + diff --git a/src/v2/generated/models/PersonPaged.ts b/src/v2/generated/models/PersonPaged.ts new file mode 100644 index 0000000..42aadc3 --- /dev/null +++ b/src/v2/generated/models/PersonPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Pagination } from '../models/Pagination.ts'; +import { Person } from '../models/Person.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* PersonPaged model +*/ +export class PersonPaged { + /** + * A page of Person results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PersonPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/PersonValue.ts b/src/v2/generated/models/PersonValue.ts new file mode 100644 index 0000000..cefd953 --- /dev/null +++ b/src/v2/generated/models/PersonValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PersonData } from '../models/PersonData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class PersonValue { + /** + * The type of value + */ + 'type': PersonValueTypeEnum; + 'data': PersonData | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "PersonValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "PersonData", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PersonValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PersonValueTypeEnum { + Person = 'person' +} + diff --git a/src/v2/generated/models/PersonsValue.ts b/src/v2/generated/models/PersonsValue.ts new file mode 100644 index 0000000..efb40a7 --- /dev/null +++ b/src/v2/generated/models/PersonsValue.ts @@ -0,0 +1,55 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PersonData } from '../models/PersonData.ts'; +import { HttpFile } from '../http/http.ts'; + +export class PersonsValue { + /** + * The type of value + */ + 'type': PersonsValueTypeEnum; + /** + * The values for many persons + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "PersonsValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PersonsValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PersonsValueTypeEnum { + PersonMulti = 'person-multi' +} + diff --git a/src/v2/generated/models/PhoneCall.ts b/src/v2/generated/models/PhoneCall.ts new file mode 100644 index 0000000..e405470 --- /dev/null +++ b/src/v2/generated/models/PhoneCall.ts @@ -0,0 +1,75 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Attendee } from '../models/Attendee.ts'; +import { HttpFile } from '../http/http.ts'; + +export class PhoneCall { + /** + * The type of interaction + */ + 'type': PhoneCallTypeEnum; + /** + * The phon_call\'s unique identifier + */ + 'id': number; + /** + * The call start time + */ + 'startTime': Date; + /** + * People attending the call + */ + 'attendees': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "PhoneCallTypeEnum", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "startTime", + "baseName": "startTime", + "type": "Date", + "format": "date-time" + }, + { + "name": "attendees", + "baseName": "attendees", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PhoneCall.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PhoneCallTypeEnum { + Call = 'call' +} + diff --git a/src/v2/generated/models/RankedDropdown.ts b/src/v2/generated/models/RankedDropdown.ts new file mode 100644 index 0000000..8f3161e --- /dev/null +++ b/src/v2/generated/models/RankedDropdown.ts @@ -0,0 +1,69 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class RankedDropdown { + /** + * Dropdown item\'s unique identifier + */ + 'dropdownOptionId': number; + /** + * Dropdown item text + */ + 'text': string; + /** + * Dropdown item rank + */ + 'rank': number; + /** + * Dropdown item color + */ + 'color': string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "dropdownOptionId", + "baseName": "dropdownOptionId", + "type": "number", + "format": "int64" + }, + { + "name": "text", + "baseName": "text", + "type": "string", + "format": "" + }, + { + "name": "rank", + "baseName": "rank", + "type": "number", + "format": "int64" + }, + { + "name": "color", + "baseName": "color", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RankedDropdown.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/RankedDropdownValue.ts b/src/v2/generated/models/RankedDropdownValue.ts new file mode 100644 index 0000000..fd038df --- /dev/null +++ b/src/v2/generated/models/RankedDropdownValue.ts @@ -0,0 +1,52 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RankedDropdown } from '../models/RankedDropdown.ts'; +import { HttpFile } from '../http/http.ts'; + +export class RankedDropdownValue { + /** + * The type of value + */ + 'type': RankedDropdownValueTypeEnum; + 'data': RankedDropdown | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "RankedDropdownValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "RankedDropdown", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RankedDropdownValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum RankedDropdownValueTypeEnum { + RankedDropdown = 'ranked-dropdown' +} + diff --git a/src/v2/generated/models/RateLimitError.ts b/src/v2/generated/models/RateLimitError.ts new file mode 100644 index 0000000..0fcd615 --- /dev/null +++ b/src/v2/generated/models/RateLimitError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class RateLimitError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RateLimitError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/SavedView.ts b/src/v2/generated/models/SavedView.ts new file mode 100644 index 0000000..2c72d98 --- /dev/null +++ b/src/v2/generated/models/SavedView.ts @@ -0,0 +1,79 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +/** +* SavedView model +*/ +export class SavedView { + /** + * The saved view\'s unique identifier + */ + 'id': number; + /** + * The saved view\'s name + */ + 'name': string; + /** + * The type for this saved view + */ + 'type': SavedViewTypeEnum; + /** + * The date that the saved view was created + */ + 'createdAt': Date; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "SavedViewTypeEnum", + "format": "" + }, + { + "name": "createdAt", + "baseName": "createdAt", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return SavedView.attributeTypeMap; + } + + public constructor() { + } +} + +export enum SavedViewTypeEnum { + Sheet = 'sheet', + Board = 'board', + Dashboard = 'dashboard' +} + diff --git a/src/v2/generated/models/SavedViewPaged.ts b/src/v2/generated/models/SavedViewPaged.ts new file mode 100644 index 0000000..c6dd455 --- /dev/null +++ b/src/v2/generated/models/SavedViewPaged.ts @@ -0,0 +1,51 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Pagination } from '../models/Pagination.ts'; +import { SavedView } from '../models/SavedView.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* SavedViewPaged model +*/ +export class SavedViewPaged { + /** + * A page of SavedView results + */ + 'data': Array; + 'pagination': Pagination; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + }, + { + "name": "pagination", + "baseName": "pagination", + "type": "Pagination", + "format": "" + } ]; + + static getAttributeTypeMap() { + return SavedViewPaged.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ServerError.ts b/src/v2/generated/models/ServerError.ts new file mode 100644 index 0000000..bd13722 --- /dev/null +++ b/src/v2/generated/models/ServerError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class ServerError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ServerError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/Tenant.ts b/src/v2/generated/models/Tenant.ts new file mode 100644 index 0000000..51ca803 --- /dev/null +++ b/src/v2/generated/models/Tenant.ts @@ -0,0 +1,59 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class Tenant { + /** + * The tenant\'s unique identifier + */ + 'id': number; + /** + * The name of the tenant + */ + 'name': string; + /** + * The tenant\'s subdomain under affinity.co + */ + 'subdomain': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "subdomain", + "baseName": "subdomain", + "type": "string", + "format": "hostname" + } ]; + + static getAttributeTypeMap() { + return Tenant.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/TextValue.ts b/src/v2/generated/models/TextValue.ts new file mode 100644 index 0000000..6836e49 --- /dev/null +++ b/src/v2/generated/models/TextValue.ts @@ -0,0 +1,55 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class TextValue { + /** + * The type of value + */ + 'type': TextValueTypeEnum; + /** + * The value for a string + */ + 'data': string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "TextValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TextValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum TextValueTypeEnum { + FilterableText = 'filterable-text', + Text = 'text' +} + diff --git a/src/v2/generated/models/TextsValue.ts b/src/v2/generated/models/TextsValue.ts new file mode 100644 index 0000000..d409613 --- /dev/null +++ b/src/v2/generated/models/TextsValue.ts @@ -0,0 +1,54 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class TextsValue { + /** + * The type of value + */ + 'type': TextsValueTypeEnum; + /** + * The value for many strings + */ + 'data': Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "TextsValueTypeEnum", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TextsValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum TextsValueTypeEnum { + FilterableTextMulti = 'filterable-text-multi' +} + diff --git a/src/v2/generated/models/TooManyMultipartFilesError.ts b/src/v2/generated/models/TooManyMultipartFilesError.ts new file mode 100644 index 0000000..f9ccd38 --- /dev/null +++ b/src/v2/generated/models/TooManyMultipartFilesError.ts @@ -0,0 +1,49 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class TooManyMultipartFilesError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TooManyMultipartFilesError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/User.ts b/src/v2/generated/models/User.ts new file mode 100644 index 0000000..e5065b6 --- /dev/null +++ b/src/v2/generated/models/User.ts @@ -0,0 +1,69 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class User { + /** + * The user\'s unique identifier + */ + 'id': number; + /** + * The user\'s first name + */ + 'firstName': string; + /** + * The user\'s last name + */ + 'lastName': string | null; + /** + * The user\'s email address + */ + 'emailAddress': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string", + "format": "" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string", + "format": "" + }, + { + "name": "emailAddress", + "baseName": "emailAddress", + "type": "string", + "format": "email" + } ]; + + static getAttributeTypeMap() { + return User.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ValidationError.ts b/src/v2/generated/models/ValidationError.ts new file mode 100644 index 0000000..019d916 --- /dev/null +++ b/src/v2/generated/models/ValidationError.ts @@ -0,0 +1,59 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http.ts'; + +export class ValidationError { + /** + * Error code + */ + 'code'?: string | null; + /** + * Error message + */ + 'message'?: string | null; + /** + * Param the error refers to + */ + 'param'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + }, + { + "name": "param", + "baseName": "param", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ValidationError.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/ValidationErrors.ts b/src/v2/generated/models/ValidationErrors.ts new file mode 100644 index 0000000..31ff251 --- /dev/null +++ b/src/v2/generated/models/ValidationErrors.ts @@ -0,0 +1,43 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ValidationError } from '../models/ValidationError.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* ValidationErrors model +*/ +export class ValidationErrors { + /** + * ValidationError errors + */ + 'errors'?: Array | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "errors", + "baseName": "errors", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ValidationErrors.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/WhoAmI.ts b/src/v2/generated/models/WhoAmI.ts new file mode 100644 index 0000000..19cdd18 --- /dev/null +++ b/src/v2/generated/models/WhoAmI.ts @@ -0,0 +1,56 @@ +/** + * Affinity API v2 + * # Introduction Welcome to Affinity API v2! This API provides a RESTful interface for building internal apps, automated workflows, and other integrations on top of the core data models in Affinity, and for connecting Affinity to the rest of your tech and data stack. Please note that this new version of the API is not at feature parity with [Affinity API v1](https://api-docs.affinity.co/). We will add to this new version to cover more of v1\'s functionality over time. **This API version is also only available on select Affinity license types.** See [this Help Center article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs) or contact your Customer Success Manager for more information. # Getting Started All Affinity API endpoints use the base URL `https://api.affinity.co`. All v2 endpoint paths start with `/v2`. Requests must be sent over HTTPS. ## Using These Docs The first few sections of these docs cover general information on the API. Each subsequent section covers a set of API endpoints. Each endpoint is documented with its accepted request parameters, expected response shapes, and a sample request and response. Please note that the shape of a given response can vary depending on what \"type\" of object or data is being returned. When this is the case, the response documentation will include a dropdown that can be used to select the \"type\" for which to display the response shape. ## Authentication Affinity API v2 uses API keys and **bearer authentication** (this is an important difference from Affinity API v1\'s use of basic authentication). To generate an API key, navigate to the Settings page in the Affinity web app. You will need the \"Generate an API key\" role-based permission controlled by your Affinity admin to be able to do this. See [this Help Center article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) for full instructions on API key generation, and [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. Currently, we support one API key per user in your Affinity account. Your API key is able to read data and perform actions in Affinity on your behalf, so keep it safe as you would a password. Provide your API key as your bearer authentication token to start making calls to Affinity API v2. ## Permissions ### Overall requirements You must have the \"Generate an API key\" permission to be able to work with the Affinity API. Most users in most Affinity accounts with API access have this by default — Contact your Affinity admin if you are not able to generate an API key, and see [this article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions) for more information on role-based permissions in Affinity. ### Resource-level permissions The Affinity API respects sharing permissions that are set in-product. For example, if a given user does not have access to a list, note, or interaction in-product, they will not be able to see or modify it via API. ### Endpoint-level permissions Many API endpoints also require endpoint-specific permissions that map to permissions in-product. These permissions, along with the \"Generate an API key\" permission, are managed by your Affinity admin in the Settings page: | API v2 Endpoint | Required Permission | | ---------------------------------------------------------- | ------------------------------------ | | GET `/v2/companies` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}` | \"Export All Organizations directory\" | | GET `/v2/companies/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/persons` | \"Export All People directory\" | | GET `/v2/persons/{id}` | \"Export All People directory\" | | GET `/v2/persons/{id}/list-entries` | \"Export data from Lists\" | | GET `/v2/opportunities` | \"Export data from Lists\" | | GET `/v2/opportunities/{id}` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/list-entries` | \"Export data from Lists\" | | GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | \"Export data from Lists\" | ## Rate Limits The Affinity API sets a limit on the number of calls that a user can make per minute, and that all the users on an account can make per month. It also sets a reasonable limit on the number of concurrent requests it will support from an account at one time. Requests to **both** Affinity API versions will count toward the one pool of requests allowed for a user or account. Once a per-minute, monthly, or concurrent rate limit is hit, subsequent requests will return an error code of 429. **We highly recommend designing your application to handle 429 errors.** ### Per-Minute Limits (User-Level) To help protect our systems, API requests will be halted at **900 per user, per minute.** We may also lower this limit on a temporary basis to manage API availability. ### Concurrent Request Limits (Account-Level) To protect our systems and manage availability across customers, we set a reasonable limit on concurrent requests at the account level. Customers should not expect to hit this limit unless they are hitting the API with heavy operations from many concurrent threads at once. ### Monthly Plan Tier Limits (Account-Level) The overall number of requests you can make per month will depend on your account\'s plan tier. **This monthly account-level limit resets at the end of each calendar month.** Current rate limits by plan tier are: | Plan Tier | Calls Per Month | | ---------- | --------------- | | Essentials | None | | Scale | 100k | | Advanced | 100k | | Enterprise | Unlimited\\* | \\*Per-Minute and Concurrent Request Limits still apply. ### Rate Limit Headers All API calls will return the following response headers with information about per-minute and monthly limits: | Header | Description | | -------------------------------- | ------------------------------------------------------- | | X-Ratelimit-Limit-User | Number of requests allowed per minute for the user | | X-Ratelimit-Limit-User-Remaining | Number of requests remaining for the user | | X-Ratelimit-Limit-User-Reset | Time in seconds before the limit resets for the user | | X-Ratelimit-Limit-Org | Number of requests allowed per month for the account | | X-Ratelimit-Limit-Org-Remaining | Number of requests remaining for the account | | X-Ratelimit-Limit-Org-Reset | Time in seconds before the limit resets for the account | ## Pagination When an endpoint is expected to return multiple results, we break the results up into pages to make them easier to handle. To cycle forward through multiple pages of data, look for the `nextUrl` property in the `pagination` portion of an API response, and use it for your next request. See endpoint documentation for more information. ## Error Codes Here is a list of the error codes this API will generally return if something goes wrong (see endpoint documentation for endpoint-specific error information): | Error Code | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | Bad Request — See endpoint documentation for more information. | | 401 | Unauthorized — Your API key is invalid. | | 403 | Forbidden — Insufficient rights to a resource. | | 404 | Not Found — Requested resource does not exist. See endpoint documentation for more information. | | 405 | Method Not Allowed — The method being used is not supported for this resource. | | 422 | Unprocessable Entity — Malformed parameters supplied. This can also happen in cases the parameters supplied logically cannot complete the request. In this case, an appropriate error message is delivered. | | 429 | Too Many Requests — You have exceeded the rate limit. | | 500 | Internal Server Error — We had a problem with our server. Try again later. | | 503 | Service Unavailable — This shouldn\'t generally happen. Contact us if you encounter this error. | # Data Model ## The Basics - The three top-level objects in Affinity are **Persons, Companies, and Opportunities**. (Please note: Companies are called Organizations in the Affinity web app.) These have profiles in the Affinity web app and can be added to Lists. - A lot of the work of Affinity happens within Lists. A **List** is a spreadsheet-like collection of rows tied to Persons, Companies, or Opportunities. - Each row on a List is a **List Entry**. A List Entry contains data and metadata about a given Person, Company, or Opportunity in the context of a List. This includes list-specific field data, and information about who added the row to the List and when. - Do note that a given entity can be added to a List more than once, i.e., it can have multiple List Entries on the same List. These List Entries can have different list-specific field data and List Entry-level metadata. - Each column on a List maps to a **Field**. Fields and field data also show up within Affinity profile pages, extensions, and integrations. - Some Fields are scoped to a single List — These are **list-specific fields**, and in the API, their data can only be accessed through the List Entry resource. \"Global\" data from other Fields can be accessed both through the Person/Company/Opportunity resource and the List Entry resource. ## Working with Field Data ### Field Types and IDs There are a few types of Fields in Affinity, differentiated by the scope and source of their data: | Field Type | Description | Example Fields | Field ID Pattern | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `enriched` | Firmographic, funding, and people Fields populated by Affinity. These can be \"Affinity Data\" Fields or come from distinct data partners. | \"Affinity Data: Description\", \"Dealroom: Number of Employees\" | A string representing the enrichment source, followed by the field name, e.g. `affinity-data-description` or `dealroom-number-of-employees`. | | `list` | Fields that are specific to the context of a given list. These can only be accessed through `*_/list-entries` endpoints in this version of the API. | Default \"Status\" and \"Amount\" columns, custom columns that pertain to a given List of deals or founders | `field-`, followed by a unique integer, e.g. `field-1234` | | `global` | Fields that persist across an Affinity account and are not list-specific. | \"My Firm\'s Founder Scoring Column\" | `field-`, followed by a unique integer, e.g. `field-1234` | | `relationship-intelligence` | Fields populated by Affinity from users\' email and calendar data that provide insight into your firm\'s relationship with a given Person/Company/Opportunity. | \"Source of Introduction\", \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", \"Last Contact\" | A string similar to the field\'s name in-product, e.g. `source-of-introduction` | ### Field Value Types Field data can take a variety of shapes. These value types are described in the Affinity Help Center [here](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list). Here is a list of the same value types, as represented in this API. Notice how array types end with `-multi`: | Single Type | Array Type | | ------------------- | ------------------------- | | `text` | Not supported in Affinity | | `number` | `number-multi` | | `datetime` | Not supported in Affinity | | `location` | `location-multi` | | `dropdown` | `dropdown-multi` | | `ranked-dropdown` | Not supported in Affinity | | `person` | `person-multi` | | `company` | `company-multi` | | `filterable-text`\\* | `filterable-text-multi`\\* | \\*Please note that `filterable-text` and `filterable-text-multi` are special types that operate similarly to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated Fields, and users cannot create Fields with these types. When an array-typed value has no data in it, the API will return `null` (rather than an empty array). ### Retrieving Field Data To retrieve field data on companies, persons, or opportunities, call GET `/v2/companies`, GET `/v2/persons`, or one of our GET `*_/list-entries` endpoints. (Note that Opportunities only have list-specific Fields, so all their field data will live on the `*_/list-entries` endpoints.) For most of these endpoints, you will need to specify the Fields for which you want data returned via the `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned without any field data attached. The GET `/v2/companies` and `/v2/persons` endpoints can return entities with enriched, global, and relationship intelligence field data attached, but do not support list-specific field data. **To get comprehensive field data including list-specific field data on Companies and Persons, use the GET `*_/list-entries` endpoints.** ### Specifying Desired Fields (Field Selection) As mentioned above, you will need to specify the Fields (either by ID or by Type) for which you want data returned when using the following endpoints: - GET `/v2/companies` - GET `/v2/companies/{id}` - GET `/v2/persons` - GET `/v2/persons/{id}` - GET `/v2/lists/{listId}/list-entries` Each of these endpoints has a `fieldIds` parameter that accepts an array of Field IDs, and a `fieldTypes` parameter that accepts an array of Field Types. Use the GET `*_/fields` endpoints to get Field IDs, Field Types, and other Field-level metadata: - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of the enriched, global, and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons, respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`. - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched, global, relationship intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are available to pull via GET `/v2/lists/{listId}/list-entries`. The following endpoints don\'t require field selection: - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below. This endpoint returns just the field data that has been pulled into the given Saved View via UI. - GET `/v2/companies/{id}/list-entries` and GET `/v2/persons/{id}/list-entries` — These endpoints return comprehensive field data for the given person or company in the context of each List Entry. ### Saved Views A Saved View allows a user to configure the Fields they want to see in the UI for a given List, and set filters and sorts on the rows on that List. A List can have multiple Saved Views. In the context of this API, Saved Views can be useful for specifying the exact Fields for which data is needed. The `*_/saved-views/{viewId}/list-entries` endpoint also respects the filters that have been set on the given Saved View in the Affinity web app. (It does not, however, respect sorts just yet.) ### Partner Data Restrictions This API supports pulling data from [Affinity Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data) fields and select [Dealroom fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ). Due the agreements we have with some of our data partners, the API does not expose data from the following sources: - Crunchbase, including Crunchbase UUID - Pitchbook - [Dealroom \"exclusive\" fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5) ## A Note on Nested Associations Some GET endpoints return \"association\" data under `fields`. For example, the Persons GET endpoints return data about which Companies a Person is associated with in Affinity. The Opportunities GET endpoints return similar data about associated Companies and Persons. The List Entries GET endpoints also return this data for Person and Opportunity List Entries. The API truncates these nested arrays of Persons or Companies **at 100 entries**. For example, if an Opportunity is associated with 200 Persons in Affinity, only 100 of those Persons will be returned by the GET `/opportunities` or `/opportunities/{id}` endpoint. # User Guides ## A Tour of Our GET Endpoints | Desired Data | Relevant Endpoints | Notes | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Company/Person/Opportunity rows from a List | Grab the List’s ID from its URL in the Affinity web app, then hit GET `/v2/lists/{listId}/list-entries` | Data returned will be restricted to the rows on the requested List | | Company/Person/Opportunity rows from a Saved View | In the Affinity web app, navigate to a List and [create a Saved View](https://support.affinity.co/hc/en-us/articles/115001508572-How-to-leverage-saved-views-within-a-list) with the desired field data and filters on it. Grab the List and Saved View IDs from the web app URL, then hit GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` | Data returned will be restricted to the rows and columns on the requested Saved View | | Full rolodex of Companies or Persons in Affinity | GET `/v2/companies`, GET `/v2/persons` | Data from list-specific Fields will not be returned | | All the rows for a given Company or Person across all Lists | GET `/v2/companies/{id}/list-entries`, GET `/v2/persons/{id}/list-entries` | | | Metadata on Fields, including Field IDs | GET `/v2/companies/fields`, GET `/v2/persons/fields`, GET `/v2/lists/{listId}/fields` | Metadata on list-specific Fields will only be returned by GET `/v2/lists/{listId}/fields` | | Metadata on Lists or Saved Views | GET `/v2/lists`, GET `/v2/lists/{listId}/saved-views` | | | Opportunity data | GET `/v2/opportunities` will only return Opportunity names and List IDs. For comprehensive Opportunity data, hit GET `/v2/lists/{listId}/list-entries` for an Opportunity List | | Tip: The ID for a List, Saved View, Person, Company, or Opportunity can always be found in its Affinity web app URL. # Changelog ## August 5, 2024 - Correct `opp` to `opportunity` to match documentation for the `List` `type` property. ## July 24, 2024 - More accurate documentation for response properties that are enums — Enums with `null` as a possible value will have it listed as one. ## March 25, 2024 - Added the ability to retrieve the date and other details of your firm\'s \"First Email\", \"Last Email\", \"First Event\", \"Last Event\", \"Next Event\", \"First Chat Message\", \"Last Chat Message\", and \"Last Contact\" with a given entity. Use these timestamps to add relationship context to your applications, and to identify founders and companies that need investors\' attention. - Endpoints that previously required a `fieldIds` parameter to return field data, now accept either `fieldIds` or `fieldTypes`, and will return field data accordingly. See the [Specifying Desired Fields (Field Selection)](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. The new `fieldTypes` parameter should make field data retrieval easier for users looking to pull data from many similar Fields at a time. ## January 4, 2023 - Most endpoints that return field data now require the user to use the `fieldIds` parameter to specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return basic entity data but not field data. ## December 12, 2023 - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment source, and data type) on Fields. See the [Retrieving Field Metadata](#section/Data-Model/Working-with-Field-Data) section of these docs for more information. + * + * OpenAPI spec version: 2.0.0 + * Contact: support@affinity.co + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Grant } from '../models/Grant.ts'; +import { Tenant } from '../models/Tenant.ts'; +import { User } from '../models/User.ts'; +import { HttpFile } from '../http/http.ts'; + +/** +* WhoAmI model +*/ +export class WhoAmI { + 'tenant': Tenant; + 'user': User; + 'grant': Grant; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "tenant", + "baseName": "tenant", + "type": "Tenant", + "format": "" + }, + { + "name": "user", + "baseName": "user", + "type": "User", + "format": "" + }, + { + "name": "grant", + "baseName": "grant", + "type": "Grant", + "format": "" + } ]; + + static getAttributeTypeMap() { + return WhoAmI.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/src/v2/generated/models/all.ts b/src/v2/generated/models/all.ts new file mode 100644 index 0000000..bb88ec1 --- /dev/null +++ b/src/v2/generated/models/all.ts @@ -0,0 +1,77 @@ +export * from '../models/Attendee.ts' +export * from '../models/AuthenticationError.ts' +export * from '../models/AuthenticationErrors.ts' +export * from '../models/AuthorizationError.ts' +export * from '../models/AuthorizationErrors.ts' +export * from '../models/ChatMessage.ts' +export * from '../models/CompaniesValue.ts' +export * from '../models/Company.ts' +export * from '../models/CompanyData.ts' +export * from '../models/CompanyListEntry.ts' +export * from '../models/CompanyPaged.ts' +export * from '../models/CompanyValue.ts' +export * from '../models/ConflictError.ts' +export * from '../models/DateValue.ts' +export * from '../models/Dropdown.ts' +export * from '../models/DropdownValue.ts' +export * from '../models/DropdownsValue.ts' +export * from '../models/Email.ts' +export * from '../models/EmptyMessageBodyError.ts' +export * from '../models/Errors.ts' +export * from '../models/Field.ts' +export * from '../models/FieldMetadata.ts' +export * from '../models/FieldMetadataPaged.ts' +export * from '../models/FieldValue.ts' +export * from '../models/FloatValue.ts' +export * from '../models/FloatsValue.ts' +export * from '../models/FormulaNumber.ts' +export * from '../models/FormulaValue.ts' +export * from '../models/GenericError.ts' +export * from '../models/Grant.ts' +export * from '../models/Interaction.ts' +export * from '../models/InteractionValue.ts' +export * from '../models/InvalidAcceptHeaderError.ts' +export * from '../models/InvalidMessageBodyError.ts' +export * from '../models/InvalidVersionHeaderError.ts' +export * from '../models/List.ts' +export * from '../models/ListEntry.ts' +export * from '../models/ListEntryPaged.ts' +export * from '../models/ListEntryWithEntity.ts' +export * from '../models/ListEntryWithEntityPaged.ts' +export * from '../models/ListPaged.ts' +export * from '../models/ListWithType.ts' +export * from '../models/ListWithTypePaged.ts' +export * from '../models/Location.ts' +export * from '../models/LocationValue.ts' +export * from '../models/LocationsValue.ts' +export * from '../models/Meeting.ts' +export * from '../models/MethodNotAllowedError.ts' +export * from '../models/ModelError.ts' +export * from '../models/NotFoundError.ts' +export * from '../models/NotFoundErrors.ts' +export * from '../models/Opportunity.ts' +export * from '../models/OpportunityListEntry.ts' +export * from '../models/OpportunityPaged.ts' +export * from '../models/OpportunityWithFields.ts' +export * from '../models/Pagination.ts' +export * from '../models/Person.ts' +export * from '../models/PersonData.ts' +export * from '../models/PersonListEntry.ts' +export * from '../models/PersonPaged.ts' +export * from '../models/PersonValue.ts' +export * from '../models/PersonsValue.ts' +export * from '../models/PhoneCall.ts' +export * from '../models/RankedDropdown.ts' +export * from '../models/RankedDropdownValue.ts' +export * from '../models/RateLimitError.ts' +export * from '../models/SavedView.ts' +export * from '../models/SavedViewPaged.ts' +export * from '../models/ServerError.ts' +export * from '../models/Tenant.ts' +export * from '../models/TextValue.ts' +export * from '../models/TextsValue.ts' +export * from '../models/TooManyMultipartFilesError.ts' +export * from '../models/User.ts' +export * from '../models/ValidationError.ts' +export * from '../models/ValidationErrors.ts' +export * from '../models/WhoAmI.ts' diff --git a/src/v2/generated/rxjsStub.ts b/src/v2/generated/rxjsStub.ts new file mode 100644 index 0000000..4c73715 --- /dev/null +++ b/src/v2/generated/rxjsStub.ts @@ -0,0 +1,27 @@ +export class Observable { + constructor(private promise: Promise) {} + + toPromise() { + return this.promise; + } + + pipe(callback: (value: T) => S | Promise): Observable { + return new Observable(this.promise.then(callback)); + } +} + +export function from(promise: Promise) { + return new Observable(promise); +} + +export function of(value: T) { + return new Observable(Promise.resolve(value)); +} + +export function mergeMap(callback: (value: T) => Observable) { + return (value: T) => callback(value).toPromise(); +} + +export function map(callback: any) { + return callback; +} diff --git a/src/v2/generated/servers.ts b/src/v2/generated/servers.ts new file mode 100644 index 0000000..9ba74ac --- /dev/null +++ b/src/v2/generated/servers.ts @@ -0,0 +1,55 @@ +import { RequestContext, HttpMethod } from "./http/http.ts"; + +export interface BaseServerConfiguration { + makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; +} + +/** + * + * Represents the configuration of a server including its + * url template and variable configuration based on the url. + * + */ +export class ServerConfiguration implements BaseServerConfiguration { + public constructor(private url: string, private variableConfiguration: T) {} + + /** + * Sets the value of the variables of this server. Variables are included in + * the `url` of this ServerConfiguration in the form `{variableName}` + * + * @param variableConfiguration a partial variable configuration for the + * variables contained in the url + */ + public setVariables(variableConfiguration: Partial) { + Object.assign(this.variableConfiguration, variableConfiguration); + } + + public getConfiguration(): T { + return this.variableConfiguration + } + + private getUrl() { + let replacedUrl = this.url; + for (const key in this.variableConfiguration) { + var re = new RegExp("{" + key + "}","g"); + replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); + } + return replacedUrl + } + + /** + * Creates a new request context for this server using the url with variables + * replaced with their respective values and the endpoint of the request appended. + * + * @param endpoint the endpoint to be queried on the server + * @param httpMethod httpMethod to be used + * + */ + public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { + return new RequestContext(this.getUrl() + endpoint, httpMethod); + } +} + +export const server1 = new ServerConfiguration<{ }>("https://api.affinity.co", { }) + +export const servers = [server1]; diff --git a/src/v2/generated/types/ObjectParamAPI.ts b/src/v2/generated/types/ObjectParamAPI.ts new file mode 100644 index 0000000..013dde9 --- /dev/null +++ b/src/v2/generated/types/ObjectParamAPI.ts @@ -0,0 +1,1010 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; +import { Configuration} from '../configuration.ts' + +import { Attendee } from '../models/Attendee.ts'; +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { ChatMessage } from '../models/ChatMessage.ts'; +import { CompaniesValue } from '../models/CompaniesValue.ts'; +import { Company } from '../models/Company.ts'; +import { CompanyData } from '../models/CompanyData.ts'; +import { CompanyListEntry } from '../models/CompanyListEntry.ts'; +import { CompanyPaged } from '../models/CompanyPaged.ts'; +import { CompanyValue } from '../models/CompanyValue.ts'; +import { ConflictError } from '../models/ConflictError.ts'; +import { DateValue } from '../models/DateValue.ts'; +import { Dropdown } from '../models/Dropdown.ts'; +import { DropdownValue } from '../models/DropdownValue.ts'; +import { DropdownsValue } from '../models/DropdownsValue.ts'; +import { Email } from '../models/Email.ts'; +import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; +import { Errors } from '../models/Errors.ts'; +import { Field } from '../models/Field.ts'; +import { FieldMetadata } from '../models/FieldMetadata.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { FieldValue } from '../models/FieldValue.ts'; +import { FloatValue } from '../models/FloatValue.ts'; +import { FloatsValue } from '../models/FloatsValue.ts'; +import { FormulaNumber } from '../models/FormulaNumber.ts'; +import { FormulaValue } from '../models/FormulaValue.ts'; +import { GenericError } from '../models/GenericError.ts'; +import { Grant } from '../models/Grant.ts'; +import { Interaction } from '../models/Interaction.ts'; +import { InteractionValue } from '../models/InteractionValue.ts'; +import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; +import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; +import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; +import { List } from '../models/List.ts'; +import { ListEntry } from '../models/ListEntry.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; +import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { ListWithType } from '../models/ListWithType.ts'; +import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; +import { Location } from '../models/Location.ts'; +import { LocationValue } from '../models/LocationValue.ts'; +import { LocationsValue } from '../models/LocationsValue.ts'; +import { Meeting } from '../models/Meeting.ts'; +import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; +import { ModelError } from '../models/ModelError.ts'; +import { NotFoundError } from '../models/NotFoundError.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Opportunity } from '../models/Opportunity.ts'; +import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; +import { OpportunityPaged } from '../models/OpportunityPaged.ts'; +import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { Person } from '../models/Person.ts'; +import { PersonData } from '../models/PersonData.ts'; +import { PersonListEntry } from '../models/PersonListEntry.ts'; +import { PersonPaged } from '../models/PersonPaged.ts'; +import { PersonValue } from '../models/PersonValue.ts'; +import { PersonsValue } from '../models/PersonsValue.ts'; +import { PhoneCall } from '../models/PhoneCall.ts'; +import { RankedDropdown } from '../models/RankedDropdown.ts'; +import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; +import { RateLimitError } from '../models/RateLimitError.ts'; +import { SavedView } from '../models/SavedView.ts'; +import { SavedViewPaged } from '../models/SavedViewPaged.ts'; +import { ServerError } from '../models/ServerError.ts'; +import { Tenant } from '../models/Tenant.ts'; +import { TextValue } from '../models/TextValue.ts'; +import { TextsValue } from '../models/TextsValue.ts'; +import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; +import { User } from '../models/User.ts'; +import { ValidationError } from '../models/ValidationError.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; +import { WhoAmI } from '../models/WhoAmI.ts'; + +import { ObservableAuthApi } from "./ObservableAPI.ts"; +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; + +export interface AuthApiGetV2AuthWhoamiRequest { +} + +export class ObjectAuthApi { + private api: ObservableAuthApi + + public constructor(configuration: Configuration, requestFactory?: AuthApiRequestFactory, responseProcessor?: AuthApiResponseProcessor) { + this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); + } + + /** + * Returns metadata about the current user. + * Get current user + * @param param the request object + */ + public getV2AuthWhoamiWithHttpInfo(param: AuthApiGetV2AuthWhoamiRequest = {}, options?: Configuration): Promise> { + return this.api.getV2AuthWhoamiWithHttpInfo( options).toPromise(); + } + + /** + * Returns metadata about the current user. + * Get current user + * @param param the request object + */ + public getV2AuthWhoami(param: AuthApiGetV2AuthWhoamiRequest = {}, options?: Configuration): Promise { + return this.api.getV2AuthWhoami( options).toPromise(); + } + +} + +import { ObservableCompaniesApi } from "./ObservableAPI.ts"; +import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; + +export interface CompaniesApiGetV2CompaniesRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof CompaniesApigetV2Companies + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof CompaniesApigetV2Companies + */ + limit?: number + /** + * Company IDs + * Defaults to: undefined + * @type Array<number> + * @memberof CompaniesApigetV2Companies + */ + ids?: Array + /** + * Field IDs for which to return field data + * Defaults to: undefined + * @type Array<string> + * @memberof CompaniesApigetV2Companies + */ + fieldIds?: Array + /** + * Field Types for which to return field data + * Defaults to: undefined + * @type Array<'enriched' | 'global' | 'relationship-intelligence'> + * @memberof CompaniesApigetV2Companies + */ + fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> +} + +export interface CompaniesApiGetV2CompaniesFieldsRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof CompaniesApigetV2CompaniesFields + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof CompaniesApigetV2CompaniesFields + */ + limit?: number +} + +export interface CompaniesApiGetV2CompaniesIdRequest { + /** + * Company ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof CompaniesApigetV2CompaniesId + */ + id: number + /** + * Field IDs for which to return field data + * Defaults to: undefined + * @type Array<string> + * @memberof CompaniesApigetV2CompaniesId + */ + fieldIds?: Array + /** + * Field Types for which to return field data + * Defaults to: undefined + * @type Array<'enriched' | 'global' | 'relationship-intelligence'> + * @memberof CompaniesApigetV2CompaniesId + */ + fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> +} + +export interface CompaniesApiGetV2CompaniesIdListEntriesRequest { + /** + * Company ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof CompaniesApigetV2CompaniesIdListEntries + */ + id: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof CompaniesApigetV2CompaniesIdListEntries + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof CompaniesApigetV2CompaniesIdListEntries + */ + limit?: number +} + +export interface CompaniesApiGetV2CompaniesIdListsRequest { + /** + * Company ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof CompaniesApigetV2CompaniesIdLists + */ + id: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof CompaniesApigetV2CompaniesIdLists + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof CompaniesApigetV2CompaniesIdLists + */ + limit?: number +} + +export class ObjectCompaniesApi { + private api: ObservableCompaniesApi + + public constructor(configuration: Configuration, requestFactory?: CompaniesApiRequestFactory, responseProcessor?: CompaniesApiResponseProcessor) { + this.api = new ObservableCompaniesApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param param the request object + */ + public getV2CompaniesWithHttpInfo(param: CompaniesApiGetV2CompaniesRequest = {}, options?: Configuration): Promise> { + return this.api.getV2CompaniesWithHttpInfo(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param param the request object + */ + public getV2Companies(param: CompaniesApiGetV2CompaniesRequest = {}, options?: Configuration): Promise { + return this.api.getV2Companies(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param param the request object + */ + public getV2CompaniesFieldsWithHttpInfo(param: CompaniesApiGetV2CompaniesFieldsRequest = {}, options?: Configuration): Promise> { + return this.api.getV2CompaniesFieldsWithHttpInfo(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param param the request object + */ + public getV2CompaniesFields(param: CompaniesApiGetV2CompaniesFieldsRequest = {}, options?: Configuration): Promise { + return this.api.getV2CompaniesFields(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param param the request object + */ + public getV2CompaniesIdWithHttpInfo(param: CompaniesApiGetV2CompaniesIdRequest, options?: Configuration): Promise> { + return this.api.getV2CompaniesIdWithHttpInfo(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param param the request object + */ + public getV2CompaniesId(param: CompaniesApiGetV2CompaniesIdRequest, options?: Configuration): Promise { + return this.api.getV2CompaniesId(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param param the request object + */ + public getV2CompaniesIdListEntriesWithHttpInfo(param: CompaniesApiGetV2CompaniesIdListEntriesRequest, options?: Configuration): Promise> { + return this.api.getV2CompaniesIdListEntriesWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param param the request object + */ + public getV2CompaniesIdListEntries(param: CompaniesApiGetV2CompaniesIdListEntriesRequest, options?: Configuration): Promise { + return this.api.getV2CompaniesIdListEntries(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param param the request object + */ + public getV2CompaniesIdListsWithHttpInfo(param: CompaniesApiGetV2CompaniesIdListsRequest, options?: Configuration): Promise> { + return this.api.getV2CompaniesIdListsWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param param the request object + */ + public getV2CompaniesIdLists(param: CompaniesApiGetV2CompaniesIdListsRequest, options?: Configuration): Promise { + return this.api.getV2CompaniesIdLists(param.id, param.cursor, param.limit, options).toPromise(); + } + +} + +import { ObservableListsApi } from "./ObservableAPI.ts"; +import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; + +export interface ListsApiGetV2ListsRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof ListsApigetV2Lists + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof ListsApigetV2Lists + */ + limit?: number +} + +export interface ListsApiGetV2ListsListidRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListid + */ + listId: number +} + +export interface ListsApiGetV2ListsListidFieldsRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidFields + */ + listId: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof ListsApigetV2ListsListidFields + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof ListsApigetV2ListsListidFields + */ + limit?: number +} + +export interface ListsApiGetV2ListsListidListEntriesRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidListEntries + */ + listId: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof ListsApigetV2ListsListidListEntries + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof ListsApigetV2ListsListidListEntries + */ + limit?: number + /** + * Field IDs for which to return field data + * Defaults to: undefined + * @type Array<string> + * @memberof ListsApigetV2ListsListidListEntries + */ + fieldIds?: Array + /** + * Field Types for which to return field data + * Defaults to: undefined + * @type Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'> + * @memberof ListsApigetV2ListsListidListEntries + */ + fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'> +} + +export interface ListsApiGetV2ListsListidSavedViewsRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidSavedViews + */ + listId: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof ListsApigetV2ListsListidSavedViews + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof ListsApigetV2ListsListidSavedViews + */ + limit?: number +} + +export interface ListsApiGetV2ListsListidSavedViewsViewidRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidSavedViewsViewid + */ + listId: number + /** + * Saved view ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidSavedViewsViewid + */ + viewId: number +} + +export interface ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest { + /** + * List ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries + */ + listId: number + /** + * Saved view ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries + */ + viewId: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof ListsApigetV2ListsListidSavedViewsViewidListEntries + */ + limit?: number +} + +export class ObjectListsApi { + private api: ObservableListsApi + + public constructor(configuration: Configuration, requestFactory?: ListsApiRequestFactory, responseProcessor?: ListsApiResponseProcessor) { + this.api = new ObservableListsApi(configuration, requestFactory, responseProcessor); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param param the request object + */ + public getV2ListsWithHttpInfo(param: ListsApiGetV2ListsRequest = {}, options?: Configuration): Promise> { + return this.api.getV2ListsWithHttpInfo(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param param the request object + */ + public getV2Lists(param: ListsApiGetV2ListsRequest = {}, options?: Configuration): Promise { + return this.api.getV2Lists(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param param the request object + */ + public getV2ListsListidWithHttpInfo(param: ListsApiGetV2ListsListidRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidWithHttpInfo(param.listId, options).toPromise(); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param param the request object + */ + public getV2ListsListid(param: ListsApiGetV2ListsListidRequest, options?: Configuration): Promise { + return this.api.getV2ListsListid(param.listId, options).toPromise(); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param param the request object + */ + public getV2ListsListidFieldsWithHttpInfo(param: ListsApiGetV2ListsListidFieldsRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidFieldsWithHttpInfo(param.listId, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param param the request object + */ + public getV2ListsListidFields(param: ListsApiGetV2ListsListidFieldsRequest, options?: Configuration): Promise { + return this.api.getV2ListsListidFields(param.listId, param.cursor, param.limit, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param param the request object + */ + public getV2ListsListidListEntriesWithHttpInfo(param: ListsApiGetV2ListsListidListEntriesRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidListEntriesWithHttpInfo(param.listId, param.cursor, param.limit, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param param the request object + */ + public getV2ListsListidListEntries(param: ListsApiGetV2ListsListidListEntriesRequest, options?: Configuration): Promise { + return this.api.getV2ListsListidListEntries(param.listId, param.cursor, param.limit, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param param the request object + */ + public getV2ListsListidSavedViewsWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidSavedViewsWithHttpInfo(param.listId, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param param the request object + */ + public getV2ListsListidSavedViews(param: ListsApiGetV2ListsListidSavedViewsRequest, options?: Configuration): Promise { + return this.api.getV2ListsListidSavedViews(param.listId, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param param the request object + */ + public getV2ListsListidSavedViewsViewidWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsViewidRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidSavedViewsViewidWithHttpInfo(param.listId, param.viewId, options).toPromise(); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param param the request object + */ + public getV2ListsListidSavedViewsViewid(param: ListsApiGetV2ListsListidSavedViewsViewidRequest, options?: Configuration): Promise { + return this.api.getV2ListsListidSavedViewsViewid(param.listId, param.viewId, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param param the request object + */ + public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(param: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, options?: Configuration): Promise> { + return this.api.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(param.listId, param.viewId, param.cursor, param.limit, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param param the request object + */ + public getV2ListsListidSavedViewsViewidListEntries(param: ListsApiGetV2ListsListidSavedViewsViewidListEntriesRequest, options?: Configuration): Promise { + return this.api.getV2ListsListidSavedViewsViewidListEntries(param.listId, param.viewId, param.cursor, param.limit, options).toPromise(); + } + +} + +import { ObservableOpportunitiesApi } from "./ObservableAPI.ts"; +import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; + +export interface OpportunitiesApiGetV2OpportunitiesRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof OpportunitiesApigetV2Opportunities + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof OpportunitiesApigetV2Opportunities + */ + limit?: number + /** + * Opportunity IDs + * Defaults to: undefined + * @type Array<number> + * @memberof OpportunitiesApigetV2Opportunities + */ + ids?: Array +} + +export interface OpportunitiesApiGetV2OpportunitiesIdRequest { + /** + * Opportunity ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof OpportunitiesApigetV2OpportunitiesId + */ + id: number +} + +export class ObjectOpportunitiesApi { + private api: ObservableOpportunitiesApi + + public constructor(configuration: Configuration, requestFactory?: OpportunitiesApiRequestFactory, responseProcessor?: OpportunitiesApiResponseProcessor) { + this.api = new ObservableOpportunitiesApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param param the request object + */ + public getV2OpportunitiesWithHttpInfo(param: OpportunitiesApiGetV2OpportunitiesRequest = {}, options?: Configuration): Promise> { + return this.api.getV2OpportunitiesWithHttpInfo(param.cursor, param.limit, param.ids, options).toPromise(); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param param the request object + */ + public getV2Opportunities(param: OpportunitiesApiGetV2OpportunitiesRequest = {}, options?: Configuration): Promise { + return this.api.getV2Opportunities(param.cursor, param.limit, param.ids, options).toPromise(); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param param the request object + */ + public getV2OpportunitiesIdWithHttpInfo(param: OpportunitiesApiGetV2OpportunitiesIdRequest, options?: Configuration): Promise> { + return this.api.getV2OpportunitiesIdWithHttpInfo(param.id, options).toPromise(); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param param the request object + */ + public getV2OpportunitiesId(param: OpportunitiesApiGetV2OpportunitiesIdRequest, options?: Configuration): Promise { + return this.api.getV2OpportunitiesId(param.id, options).toPromise(); + } + +} + +import { ObservablePersonsApi } from "./ObservableAPI.ts"; +import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; + +export interface PersonsApiGetV2PersonsRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof PersonsApigetV2Persons + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof PersonsApigetV2Persons + */ + limit?: number + /** + * People IDs + * Defaults to: undefined + * @type Array<number> + * @memberof PersonsApigetV2Persons + */ + ids?: Array + /** + * Field IDs for which to return field data + * Defaults to: undefined + * @type Array<string> + * @memberof PersonsApigetV2Persons + */ + fieldIds?: Array + /** + * Field Types for which to return field data + * Defaults to: undefined + * @type Array<'enriched' | 'global' | 'relationship-intelligence'> + * @memberof PersonsApigetV2Persons + */ + fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> +} + +export interface PersonsApiGetV2PersonsFieldsRequest { + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof PersonsApigetV2PersonsFields + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof PersonsApigetV2PersonsFields + */ + limit?: number +} + +export interface PersonsApiGetV2PersonsIdRequest { + /** + * Person ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof PersonsApigetV2PersonsId + */ + id: number + /** + * Field IDs for which to return field data + * Defaults to: undefined + * @type Array<string> + * @memberof PersonsApigetV2PersonsId + */ + fieldIds?: Array + /** + * Field Types for which to return field data + * Defaults to: undefined + * @type Array<'enriched' | 'global' | 'relationship-intelligence'> + * @memberof PersonsApigetV2PersonsId + */ + fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'> +} + +export interface PersonsApiGetV2PersonsIdListEntriesRequest { + /** + * Persons ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof PersonsApigetV2PersonsIdListEntries + */ + id: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof PersonsApigetV2PersonsIdListEntries + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof PersonsApigetV2PersonsIdListEntries + */ + limit?: number +} + +export interface PersonsApiGetV2PersonsIdListsRequest { + /** + * Persons ID + * Minimum: 1 + * Maximum: -9223372036854775616 + * Defaults to: undefined + * @type number + * @memberof PersonsApigetV2PersonsIdLists + */ + id: number + /** + * Cursor for the next or previous page + * Defaults to: undefined + * @type string + * @memberof PersonsApigetV2PersonsIdLists + */ + cursor?: string + /** + * Number of items to include in the page + * Minimum: 1 + * Maximum: 100 + * Defaults to: 100 + * @type number + * @memberof PersonsApigetV2PersonsIdLists + */ + limit?: number +} + +export class ObjectPersonsApi { + private api: ObservablePersonsApi + + public constructor(configuration: Configuration, requestFactory?: PersonsApiRequestFactory, responseProcessor?: PersonsApiResponseProcessor) { + this.api = new ObservablePersonsApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param param the request object + */ + public getV2PersonsWithHttpInfo(param: PersonsApiGetV2PersonsRequest = {}, options?: Configuration): Promise> { + return this.api.getV2PersonsWithHttpInfo(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param param the request object + */ + public getV2Persons(param: PersonsApiGetV2PersonsRequest = {}, options?: Configuration): Promise { + return this.api.getV2Persons(param.cursor, param.limit, param.ids, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param param the request object + */ + public getV2PersonsFieldsWithHttpInfo(param: PersonsApiGetV2PersonsFieldsRequest = {}, options?: Configuration): Promise> { + return this.api.getV2PersonsFieldsWithHttpInfo(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param param the request object + */ + public getV2PersonsFields(param: PersonsApiGetV2PersonsFieldsRequest = {}, options?: Configuration): Promise { + return this.api.getV2PersonsFields(param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param param the request object + */ + public getV2PersonsIdWithHttpInfo(param: PersonsApiGetV2PersonsIdRequest, options?: Configuration): Promise> { + return this.api.getV2PersonsIdWithHttpInfo(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param param the request object + */ + public getV2PersonsId(param: PersonsApiGetV2PersonsIdRequest, options?: Configuration): Promise { + return this.api.getV2PersonsId(param.id, param.fieldIds, param.fieldTypes, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param param the request object + */ + public getV2PersonsIdListEntriesWithHttpInfo(param: PersonsApiGetV2PersonsIdListEntriesRequest, options?: Configuration): Promise> { + return this.api.getV2PersonsIdListEntriesWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param param the request object + */ + public getV2PersonsIdListEntries(param: PersonsApiGetV2PersonsIdListEntriesRequest, options?: Configuration): Promise { + return this.api.getV2PersonsIdListEntries(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param param the request object + */ + public getV2PersonsIdListsWithHttpInfo(param: PersonsApiGetV2PersonsIdListsRequest, options?: Configuration): Promise> { + return this.api.getV2PersonsIdListsWithHttpInfo(param.id, param.cursor, param.limit, options).toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param param the request object + */ + public getV2PersonsIdLists(param: PersonsApiGetV2PersonsIdListsRequest, options?: Configuration): Promise { + return this.api.getV2PersonsIdLists(param.id, param.cursor, param.limit, options).toPromise(); + } + +} diff --git a/src/v2/generated/types/ObservableAPI.ts b/src/v2/generated/types/ObservableAPI.ts new file mode 100644 index 0000000..c0c5ca1 --- /dev/null +++ b/src/v2/generated/types/ObservableAPI.ts @@ -0,0 +1,903 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; +import { Configuration} from '../configuration.ts' +import { Observable, of, from } from '../rxjsStub.ts'; +import {mergeMap, map} from '../rxjsStub.ts'; +import { Attendee } from '../models/Attendee.ts'; +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { ChatMessage } from '../models/ChatMessage.ts'; +import { CompaniesValue } from '../models/CompaniesValue.ts'; +import { Company } from '../models/Company.ts'; +import { CompanyData } from '../models/CompanyData.ts'; +import { CompanyListEntry } from '../models/CompanyListEntry.ts'; +import { CompanyPaged } from '../models/CompanyPaged.ts'; +import { CompanyValue } from '../models/CompanyValue.ts'; +import { ConflictError } from '../models/ConflictError.ts'; +import { DateValue } from '../models/DateValue.ts'; +import { Dropdown } from '../models/Dropdown.ts'; +import { DropdownValue } from '../models/DropdownValue.ts'; +import { DropdownsValue } from '../models/DropdownsValue.ts'; +import { Email } from '../models/Email.ts'; +import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; +import { Errors } from '../models/Errors.ts'; +import { Field } from '../models/Field.ts'; +import { FieldMetadata } from '../models/FieldMetadata.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { FieldValue } from '../models/FieldValue.ts'; +import { FloatValue } from '../models/FloatValue.ts'; +import { FloatsValue } from '../models/FloatsValue.ts'; +import { FormulaNumber } from '../models/FormulaNumber.ts'; +import { FormulaValue } from '../models/FormulaValue.ts'; +import { GenericError } from '../models/GenericError.ts'; +import { Grant } from '../models/Grant.ts'; +import { Interaction } from '../models/Interaction.ts'; +import { InteractionValue } from '../models/InteractionValue.ts'; +import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; +import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; +import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; +import { List } from '../models/List.ts'; +import { ListEntry } from '../models/ListEntry.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; +import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { ListWithType } from '../models/ListWithType.ts'; +import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; +import { Location } from '../models/Location.ts'; +import { LocationValue } from '../models/LocationValue.ts'; +import { LocationsValue } from '../models/LocationsValue.ts'; +import { Meeting } from '../models/Meeting.ts'; +import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; +import { ModelError } from '../models/ModelError.ts'; +import { NotFoundError } from '../models/NotFoundError.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Opportunity } from '../models/Opportunity.ts'; +import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; +import { OpportunityPaged } from '../models/OpportunityPaged.ts'; +import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { Person } from '../models/Person.ts'; +import { PersonData } from '../models/PersonData.ts'; +import { PersonListEntry } from '../models/PersonListEntry.ts'; +import { PersonPaged } from '../models/PersonPaged.ts'; +import { PersonValue } from '../models/PersonValue.ts'; +import { PersonsValue } from '../models/PersonsValue.ts'; +import { PhoneCall } from '../models/PhoneCall.ts'; +import { RankedDropdown } from '../models/RankedDropdown.ts'; +import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; +import { RateLimitError } from '../models/RateLimitError.ts'; +import { SavedView } from '../models/SavedView.ts'; +import { SavedViewPaged } from '../models/SavedViewPaged.ts'; +import { ServerError } from '../models/ServerError.ts'; +import { Tenant } from '../models/Tenant.ts'; +import { TextValue } from '../models/TextValue.ts'; +import { TextsValue } from '../models/TextsValue.ts'; +import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; +import { User } from '../models/User.ts'; +import { ValidationError } from '../models/ValidationError.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; +import { WhoAmI } from '../models/WhoAmI.ts'; + +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; +export class ObservableAuthApi { + private requestFactory: AuthApiRequestFactory; + private responseProcessor: AuthApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: AuthApiRequestFactory, + responseProcessor?: AuthApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new AuthApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new AuthApiResponseProcessor(); + } + + /** + * Returns metadata about the current user. + * Get current user + */ + public getV2AuthWhoamiWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2AuthWhoami(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2AuthWhoamiWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata about the current user. + * Get current user + */ + public getV2AuthWhoami(_options?: Configuration): Observable { + return this.getV2AuthWhoamiWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; +export class ObservableCompaniesApi { + private requestFactory: CompaniesApiRequestFactory; + private responseProcessor: CompaniesApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: CompaniesApiRequestFactory, + responseProcessor?: CompaniesApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new CompaniesApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new CompaniesApiResponseProcessor(); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Company IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2Companies(cursor, limit, ids, fieldIds, fieldTypes, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Company IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { + return this.getV2CompaniesWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2CompaniesFields(cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesFieldsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2CompaniesFieldsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param id Company ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2CompaniesId(id, fieldIds, fieldTypes, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdWithHttpInfo(rsp))); + })); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param id Company ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { + return this.getV2CompaniesIdWithHttpInfo(id, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2CompaniesIdListEntries(id, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdListEntriesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2CompaniesIdListEntriesWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2CompaniesIdLists(id, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2CompaniesIdListsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2CompaniesIdListsWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; +export class ObservableListsApi { + private requestFactory: ListsApiRequestFactory; + private responseProcessor: ListsApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: ListsApiRequestFactory, + responseProcessor?: ListsApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new ListsApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new ListsApiResponseProcessor(); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2Lists(cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2ListsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param listId List ID + */ + public getV2ListsListidWithHttpInfo(listId: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListid(listId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param listId List ID + */ + public getV2ListsListid(listId: number, _options?: Configuration): Observable { + return this.getV2ListsListidWithHttpInfo(listId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidFieldsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListidFields(listId, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidFieldsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2ListsListidFieldsWithHttpInfo(listId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2ListsListidListEntriesWithHttpInfo(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListidListEntries(listId, cursor, limit, fieldIds, fieldTypes, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidListEntriesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Observable { + return this.getV2ListsListidListEntriesWithHttpInfo(listId, cursor, limit, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListidSavedViews(listId, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2ListsListidSavedViewsWithHttpInfo(listId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param listId List ID + * @param viewId Saved view ID + */ + public getV2ListsListidSavedViewsViewidWithHttpInfo(listId: number, viewId: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListidSavedViewsViewid(listId, viewId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsViewidWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param listId List ID + * @param viewId Saved view ID + */ + public getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Observable { + return this.getV2ListsListidSavedViewsViewidWithHttpInfo(listId, viewId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param listId List ID + * @param viewId Saved view ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2ListsListidSavedViewsViewidListEntries(listId, viewId, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param listId List ID + * @param viewId Saved view ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId, viewId, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; +export class ObservableOpportunitiesApi { + private requestFactory: OpportunitiesApiRequestFactory; + private responseProcessor: OpportunitiesApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: OpportunitiesApiRequestFactory, + responseProcessor?: OpportunitiesApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new OpportunitiesApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new OpportunitiesApiResponseProcessor(); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Opportunity IDs + */ + public getV2OpportunitiesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2Opportunities(cursor, limit, ids, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2OpportunitiesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Opportunity IDs + */ + public getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Observable { + return this.getV2OpportunitiesWithHttpInfo(cursor, limit, ids, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param id Opportunity ID + */ + public getV2OpportunitiesIdWithHttpInfo(id: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2OpportunitiesId(id, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2OpportunitiesIdWithHttpInfo(rsp))); + })); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param id Opportunity ID + */ + public getV2OpportunitiesId(id: number, _options?: Configuration): Observable { + return this.getV2OpportunitiesIdWithHttpInfo(id, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; +export class ObservablePersonsApi { + private requestFactory: PersonsApiRequestFactory; + private responseProcessor: PersonsApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: PersonsApiRequestFactory, + responseProcessor?: PersonsApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new PersonsApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new PersonsApiResponseProcessor(); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] People IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2Persons(cursor, limit, ids, fieldIds, fieldTypes, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] People IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { + return this.getV2PersonsWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2PersonsFields(cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsFieldsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2PersonsFieldsWithHttpInfo(cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param id Person ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2PersonsId(id, fieldIds, fieldTypes, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdWithHttpInfo(rsp))); + })); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param id Person ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Observable { + return this.getV2PersonsIdWithHttpInfo(id, fieldIds, fieldTypes, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2PersonsIdListEntries(id, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdListEntriesWithHttpInfo(rsp))); + })); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2PersonsIdListEntriesWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getV2PersonsIdLists(id, cursor, limit, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getV2PersonsIdListsWithHttpInfo(rsp))); + })); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Observable { + return this.getV2PersonsIdListsWithHttpInfo(id, cursor, limit, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} diff --git a/src/v2/generated/types/PromiseAPI.ts b/src/v2/generated/types/PromiseAPI.ts new file mode 100644 index 0000000..e2881af --- /dev/null +++ b/src/v2/generated/types/PromiseAPI.ts @@ -0,0 +1,647 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; +import { Configuration} from '../configuration.ts' + +import { Attendee } from '../models/Attendee.ts'; +import { AuthenticationError } from '../models/AuthenticationError.ts'; +import { AuthenticationErrors } from '../models/AuthenticationErrors.ts'; +import { AuthorizationError } from '../models/AuthorizationError.ts'; +import { AuthorizationErrors } from '../models/AuthorizationErrors.ts'; +import { ChatMessage } from '../models/ChatMessage.ts'; +import { CompaniesValue } from '../models/CompaniesValue.ts'; +import { Company } from '../models/Company.ts'; +import { CompanyData } from '../models/CompanyData.ts'; +import { CompanyListEntry } from '../models/CompanyListEntry.ts'; +import { CompanyPaged } from '../models/CompanyPaged.ts'; +import { CompanyValue } from '../models/CompanyValue.ts'; +import { ConflictError } from '../models/ConflictError.ts'; +import { DateValue } from '../models/DateValue.ts'; +import { Dropdown } from '../models/Dropdown.ts'; +import { DropdownValue } from '../models/DropdownValue.ts'; +import { DropdownsValue } from '../models/DropdownsValue.ts'; +import { Email } from '../models/Email.ts'; +import { EmptyMessageBodyError } from '../models/EmptyMessageBodyError.ts'; +import { Errors } from '../models/Errors.ts'; +import { Field } from '../models/Field.ts'; +import { FieldMetadata } from '../models/FieldMetadata.ts'; +import { FieldMetadataPaged } from '../models/FieldMetadataPaged.ts'; +import { FieldValue } from '../models/FieldValue.ts'; +import { FloatValue } from '../models/FloatValue.ts'; +import { FloatsValue } from '../models/FloatsValue.ts'; +import { FormulaNumber } from '../models/FormulaNumber.ts'; +import { FormulaValue } from '../models/FormulaValue.ts'; +import { GenericError } from '../models/GenericError.ts'; +import { Grant } from '../models/Grant.ts'; +import { Interaction } from '../models/Interaction.ts'; +import { InteractionValue } from '../models/InteractionValue.ts'; +import { InvalidAcceptHeaderError } from '../models/InvalidAcceptHeaderError.ts'; +import { InvalidMessageBodyError } from '../models/InvalidMessageBodyError.ts'; +import { InvalidVersionHeaderError } from '../models/InvalidVersionHeaderError.ts'; +import { List } from '../models/List.ts'; +import { ListEntry } from '../models/ListEntry.ts'; +import { ListEntryPaged } from '../models/ListEntryPaged.ts'; +import { ListEntryWithEntity } from '../models/ListEntryWithEntity.ts'; +import { ListEntryWithEntityPaged } from '../models/ListEntryWithEntityPaged.ts'; +import { ListPaged } from '../models/ListPaged.ts'; +import { ListWithType } from '../models/ListWithType.ts'; +import { ListWithTypePaged } from '../models/ListWithTypePaged.ts'; +import { Location } from '../models/Location.ts'; +import { LocationValue } from '../models/LocationValue.ts'; +import { LocationsValue } from '../models/LocationsValue.ts'; +import { Meeting } from '../models/Meeting.ts'; +import { MethodNotAllowedError } from '../models/MethodNotAllowedError.ts'; +import { ModelError } from '../models/ModelError.ts'; +import { NotFoundError } from '../models/NotFoundError.ts'; +import { NotFoundErrors } from '../models/NotFoundErrors.ts'; +import { Opportunity } from '../models/Opportunity.ts'; +import { OpportunityListEntry } from '../models/OpportunityListEntry.ts'; +import { OpportunityPaged } from '../models/OpportunityPaged.ts'; +import { OpportunityWithFields } from '../models/OpportunityWithFields.ts'; +import { Pagination } from '../models/Pagination.ts'; +import { Person } from '../models/Person.ts'; +import { PersonData } from '../models/PersonData.ts'; +import { PersonListEntry } from '../models/PersonListEntry.ts'; +import { PersonPaged } from '../models/PersonPaged.ts'; +import { PersonValue } from '../models/PersonValue.ts'; +import { PersonsValue } from '../models/PersonsValue.ts'; +import { PhoneCall } from '../models/PhoneCall.ts'; +import { RankedDropdown } from '../models/RankedDropdown.ts'; +import { RankedDropdownValue } from '../models/RankedDropdownValue.ts'; +import { RateLimitError } from '../models/RateLimitError.ts'; +import { SavedView } from '../models/SavedView.ts'; +import { SavedViewPaged } from '../models/SavedViewPaged.ts'; +import { ServerError } from '../models/ServerError.ts'; +import { Tenant } from '../models/Tenant.ts'; +import { TextValue } from '../models/TextValue.ts'; +import { TextsValue } from '../models/TextsValue.ts'; +import { TooManyMultipartFilesError } from '../models/TooManyMultipartFilesError.ts'; +import { User } from '../models/User.ts'; +import { ValidationError } from '../models/ValidationError.ts'; +import { ValidationErrors } from '../models/ValidationErrors.ts'; +import { WhoAmI } from '../models/WhoAmI.ts'; +import { ObservableAuthApi } from './ObservableAPI.ts'; + +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi.ts"; +export class PromiseAuthApi { + private api: ObservableAuthApi + + public constructor( + configuration: Configuration, + requestFactory?: AuthApiRequestFactory, + responseProcessor?: AuthApiResponseProcessor + ) { + this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); + } + + /** + * Returns metadata about the current user. + * Get current user + */ + public getV2AuthWhoamiWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getV2AuthWhoamiWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * Returns metadata about the current user. + * Get current user + */ + public getV2AuthWhoami(_options?: Configuration): Promise { + const result = this.api.getV2AuthWhoami(_options); + return result.toPromise(); + } + + +} + + + +import { ObservableCompaniesApi } from './ObservableAPI.ts'; + +import { CompaniesApiRequestFactory, CompaniesApiResponseProcessor} from "../apis/CompaniesApi.ts"; +export class PromiseCompaniesApi { + private api: ObservableCompaniesApi + + public constructor( + configuration: Configuration, + requestFactory?: CompaniesApiRequestFactory, + responseProcessor?: CompaniesApiResponseProcessor + ) { + this.api = new ObservableCompaniesApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Company IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { + const result = this.api.getV2CompaniesWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Paginate through Companies in Affinity. Returns basic information and non-list-specific field data on each Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get all Companies + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Company IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2Companies(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + const result = this.api.getV2Companies(cursor, limit, ids, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2CompaniesFieldsWithHttpInfo(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on non-list-specific Company Fields. Use the returned Field IDs to request field data from the GET `/v2/companies` and GET `/v2/companies/{id}` endpoints. + * Get metadata on Company Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesFields(cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2CompaniesFields(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param id Company ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { + const result = this.api.getV2CompaniesIdWithHttpInfo(id, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Company. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/companies/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Companies will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All Organizations directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Company + * @param id Company ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2CompaniesId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + const result = this.api.getV2CompaniesId(id, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2CompaniesIdListEntriesWithHttpInfo(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Company across all Lists. Each List Entry includes field data for the Company, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Company\'s List Entries + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2CompaniesIdListEntries(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2CompaniesIdListsWithHttpInfo(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Company appears. + * Get a Company\'s Lists + * @param id Company ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2CompaniesIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2CompaniesIdLists(id, cursor, limit, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableListsApi } from './ObservableAPI.ts'; + +import { ListsApiRequestFactory, ListsApiResponseProcessor} from "../apis/ListsApi.ts"; +export class PromiseListsApi { + private api: ObservableListsApi + + public constructor( + configuration: Configuration, + requestFactory?: ListsApiRequestFactory, + responseProcessor?: ListsApiResponseProcessor + ) { + this.api = new ObservableListsApi(configuration, requestFactory, responseProcessor); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsWithHttpInfo(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on Lists. + * Get metadata on all Lists + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2Lists(cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2Lists(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param listId List ID + */ + public getV2ListsListidWithHttpInfo(listId: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidWithHttpInfo(listId, _options); + return result.toPromise(); + } + + /** + * Returns metadata on a single List. + * Get metadata on a single List + * @param listId List ID + */ + public getV2ListsListid(listId: number, _options?: Configuration): Promise { + const result = this.api.getV2ListsListid(listId, _options); + return result.toPromise(); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidFieldsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidFieldsWithHttpInfo(listId, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on the Fields available on a single List. Use the returned Field IDs to request field data from the GET `/v2/lists/{listId}/list-entries` endpoint. + * Get metadata on a single List\'s Fields + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidFields(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2ListsListidFields(listId, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2ListsListidListEntriesWithHttpInfo(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidListEntriesWithHttpInfo(listId, cursor, limit, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given List. Returns basic information and field data, including list-specific field data, on each Company, Person, or Opportunity on the List. List Entries also include metadata about their creation, i.e., when they were added to the List and by whom. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/lists/{listId}/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, List Entries will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a List + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2ListsListidListEntries(listId: number, cursor?: string, limit?: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'list' | 'relationship-intelligence'>, _options?: Configuration): Promise { + const result = this.api.getV2ListsListidListEntries(listId, cursor, limit, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsWithHttpInfo(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidSavedViewsWithHttpInfo(listId, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on the Saved Views on a List. + * Get metadata on Saved Views + * @param listId List ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViews(listId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2ListsListidSavedViews(listId, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param listId List ID + * @param viewId Saved view ID + */ + public getV2ListsListidSavedViewsViewidWithHttpInfo(listId: number, viewId: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidSavedViewsViewidWithHttpInfo(listId, viewId, _options); + return result.toPromise(); + } + + /** + * Returns metadata on a single Saved View. + * Get metadata on a single Saved View + * @param listId List ID + * @param viewId Saved view ID + */ + public getV2ListsListidSavedViewsViewid(listId: number, viewId: number, _options?: Configuration): Promise { + const result = this.api.getV2ListsListidSavedViewsViewid(listId, viewId, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param listId List ID + * @param viewId Saved view ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2ListsListidSavedViewsViewidListEntriesWithHttpInfo(listId, viewId, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) on a given Saved View. Use this endpoint when you need to filter entities or only want **some** field data to be returned: This endpoint respects the filters set on a Saved View via web app, and only returns field data corresponding to the columns that have been pulled into the Saved View via web app. Though this endpoint respects the Saved View\'s filters and column/Field selection, it does not yet preserve sort order. This endpoint also only supports **sheet-type Saved Views**, and not board- or dashboard-type Saved Views. See the [Data Model](#section/Data-Model) section for more information about Saved Views. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all List Entries on a Saved View + * @param listId List ID + * @param viewId Saved view ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2ListsListidSavedViewsViewidListEntries(listId: number, viewId: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2ListsListidSavedViewsViewidListEntries(listId, viewId, cursor, limit, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableOpportunitiesApi } from './ObservableAPI.ts'; + +import { OpportunitiesApiRequestFactory, OpportunitiesApiResponseProcessor} from "../apis/OpportunitiesApi.ts"; +export class PromiseOpportunitiesApi { + private api: ObservableOpportunitiesApi + + public constructor( + configuration: Configuration, + requestFactory?: OpportunitiesApiRequestFactory, + responseProcessor?: OpportunitiesApiResponseProcessor + ) { + this.api = new ObservableOpportunitiesApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Opportunity IDs + */ + public getV2OpportunitiesWithHttpInfo(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise> { + const result = this.api.getV2OpportunitiesWithHttpInfo(cursor, limit, ids, _options); + return result.toPromise(); + } + + /** + * Paginate through Opportunities in Affinity. Returns basic information but **not** field data on each Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get all Opportunities + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] Opportunity IDs + */ + public getV2Opportunities(cursor?: string, limit?: number, ids?: Array, _options?: Configuration): Promise { + const result = this.api.getV2Opportunities(cursor, limit, ids, _options); + return result.toPromise(); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param id Opportunity ID + */ + public getV2OpportunitiesIdWithHttpInfo(id: number, _options?: Configuration): Promise> { + const result = this.api.getV2OpportunitiesIdWithHttpInfo(id, _options); + return result.toPromise(); + } + + /** + * Returns basic information but **not** field data on the requested Opportunity. To access field data on Opportunities, use the `/lists/{list_id}/list-entries` or the `/v2/lists/{list_id}/saved-views/{view_id}/list-entries` GET endpoint. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a single Opportunity + * @param id Opportunity ID + */ + public getV2OpportunitiesId(id: number, _options?: Configuration): Promise { + const result = this.api.getV2OpportunitiesId(id, _options); + return result.toPromise(); + } + + +} + + + +import { ObservablePersonsApi } from './ObservableAPI.ts'; + +import { PersonsApiRequestFactory, PersonsApiResponseProcessor} from "../apis/PersonsApi.ts"; +export class PromisePersonsApi { + private api: ObservablePersonsApi + + public constructor( + configuration: Configuration, + requestFactory?: PersonsApiRequestFactory, + responseProcessor?: PersonsApiResponseProcessor + ) { + this.api = new ObservablePersonsApi(configuration, requestFactory, responseProcessor); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] People IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsWithHttpInfo(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { + const result = this.api.getV2PersonsWithHttpInfo(cursor, limit, ids, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Paginate through Persons in Affinity. Returns basic information and non-list-specific field data on each Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get all Persons + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + * @param [ids] People IDs + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2Persons(cursor?: string, limit?: number, ids?: Array, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + const result = this.api.getV2Persons(cursor, limit, ids, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsFieldsWithHttpInfo(cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2PersonsFieldsWithHttpInfo(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata on non-list-specific Person Fields. Use the returned Field IDs to request field data from the GET `/v2/persons` and GET `/v2/persons/{id}` endpoints. + * Get metadata on Person Fields + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsFields(cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2PersonsFields(cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param id Person ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsIdWithHttpInfo(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise> { + const result = this.api.getV2PersonsIdWithHttpInfo(id, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Returns basic information and non-list-specific field data on the requested Person. To retrieve field data, you must use either the `fieldIds` or the `fieldTypes` parameter to specify the Fields for which you want data returned. These Field IDs and Types can be found using the GET `/v2/persons/fields` endpoint. When no `fieldIds` or `fieldTypes` are provided, Persons will be returned without any field data attached. To supply multiple `fieldIds` or `fieldTypes` parameters, generate a query string that looks like this: `?fieldIds=field-1234&fieldIds=affinity-data-location` or `?fieldTypes=enriched&fieldTypes=global`. Requires the \"Export All People directory\" [permission](#section/Getting-Started/Permissions). + * Get a single Person + * @param id Person ID + * @param [fieldIds] Field IDs for which to return field data + * @param [fieldTypes] Field Types for which to return field data + */ + public getV2PersonsId(id: number, fieldIds?: Array, fieldTypes?: Array<'enriched' | 'global' | 'relationship-intelligence'>, _options?: Configuration): Promise { + const result = this.api.getV2PersonsId(id, fieldIds, fieldTypes, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListEntriesWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2PersonsIdListEntriesWithHttpInfo(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Paginate through the List Entries (AKA rows) for the given Person across all Lists. Each List Entry includes field data for the Person, including list-specific field data. Each List Entry also includes metadata about its creation, i.e., when it was added to the List and by whom. Requires the \"Export data from Lists\" [permission](#section/Getting-Started/Permissions). + * Get a Person\'s List Entries + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListEntries(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2PersonsIdListEntries(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdListsWithHttpInfo(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise> { + const result = this.api.getV2PersonsIdListsWithHttpInfo(id, cursor, limit, _options); + return result.toPromise(); + } + + /** + * Returns metadata for all the Lists on which the given Person appears. + * Get a Person\'s Lists + * @param id Persons ID + * @param [cursor] Cursor for the next or previous page + * @param [limit] Number of items to include in the page + */ + public getV2PersonsIdLists(id: number, cursor?: string, limit?: number, _options?: Configuration): Promise { + const result = this.api.getV2PersonsIdLists(id, cursor, limit, _options); + return result.toPromise(); + } + + +} + + + diff --git a/src/v2/generated/util.ts b/src/v2/generated/util.ts new file mode 100644 index 0000000..96ea3df --- /dev/null +++ b/src/v2/generated/util.ts @@ -0,0 +1,37 @@ +/** + * Returns if a specific http code is in a given code range + * where the code range is defined as a combination of digits + * and "X" (the letter X) with a length of 3 + * + * @param codeRange string with length 3 consisting of digits and "X" (the letter X) + * @param code the http status code to be checked against the code range + */ +export function isCodeInRange(codeRange: string, code: number): boolean { + // This is how the default value is encoded in OAG + if (codeRange === "0") { + return true; + } + if (codeRange == code.toString()) { + return true; + } else { + const codeString = code.toString(); + if (codeString.length != codeRange.length) { + return false; + } + for (let i = 0; i < codeString.length; i++) { + if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { + return false; + } + } + return true; + } +} + +/** +* Returns if it can consume form +* +* @param consumes array +*/ +export function canConsumeForm(contentTypes: string[]): boolean { + return contentTypes.indexOf('multipart/form-data') !== -1 +} From 9b20ae0d1446317fcbc63a5cd93bededcd3ecffa Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 2 Oct 2024 17:47:49 +0100 Subject: [PATCH 3/5] chore: partial revert --- deno.jsonc | 6 +- deno.lock | 527 ++++++++++++++++++++++++++++++----------------------- flake.nix | 1 - 3 files changed, 306 insertions(+), 228 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 8dece39..0b6133a 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@deno/dnt": "jsr:@deno/dnt@^0.41.3", "@std/assert": "jsr:@std/assert@^1.0.0", "@std/fs": "jsr:@std/fs@^1.0.0", "@std/jsonc": "jsr:@std/jsonc@^1.0.0", @@ -24,8 +24,8 @@ "snapshot-update": "deno task test --allow-write=./src/v1/tests/__snapshots__,./src/v2/tests/__snapshots__ -- --update", "format": "deno fmt && nixpkgs-fmt *.nix && yamllint . && yamlfmt .", "lint": "deno lint", - "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.6", - "generate-v2-client": "rm -rf src/v2/generated && openapi-generator-cli generate", + "docs": "deno run --allow-read --allow-env --allow-run --allow-write=./docs/ npm:typedoc@0.26.7", + "generate-v2-client": "rm -rf src/v2/generated && deno run --allow-read --allow-run --allow-env --allow-write=openapitools.json,node_modules,/tmp,/var --allow-net='search.maven.org,repo1.maven.org,oss.sonatype.org:443' npm:@openapitools/openapi-generator-cli@2.13.12 generate", "update-deno-lock": "deno cache --lock-write src/index.ts", "update-flake-lock": "nix --option commit-lockfile-summary 'chore: update flake.lock' flake update --commit-lock-file", "update": "deno run --allow-env --allow-read --allow-write='~/.local,.' --allow-run=git,deno --allow-net=jsr.io jsr:@molt/cli", diff --git a/deno.lock b/deno.lock index dec0f0e..ab4d215 100644 --- a/deno.lock +++ b/deno.lock @@ -4,50 +4,41 @@ "specifiers": { "jsr:@david/code-block-writer@^13.0.2": "jsr:@david/code-block-writer@13.0.2", "jsr:@deno/cache-dir@^0.10.3": "jsr:@deno/cache-dir@0.10.3", - "jsr:@deno/dnt@^0.41.2": "jsr:@deno/dnt@0.41.3", - "jsr:@deno/graph@^0.73.1": "jsr:@deno/graph@0.73.1", + "jsr:@deno/dnt@^0.41.3": "jsr:@deno/dnt@0.41.3", "jsr:@std/assert@^0.223.0": "jsr:@std/assert@0.223.0", "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", - "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.2", - "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.2", - "jsr:@std/async@^1.0.2": "jsr:@std/async@1.0.3", + "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.6", + "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.6", "jsr:@std/bytes@^0.223.0": "jsr:@std/bytes@0.223.0", - "jsr:@std/bytes@^1.0.2-rc.3": "jsr:@std/bytes@1.0.2", - "jsr:@std/data-structures@^1.0.1": "jsr:@std/data-structures@1.0.1", - "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.0", + "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.2", "jsr:@std/fmt@^0.223": "jsr:@std/fmt@0.223.0", - "jsr:@std/fmt@^0.223.0": "jsr:@std/fmt@0.223.0", - "jsr:@std/fmt@^0.225.3": "jsr:@std/fmt@0.225.3", - "jsr:@std/fs@1": "jsr:@std/fs@1.0.1", + "jsr:@std/fs@1": "jsr:@std/fs@1.0.4", "jsr:@std/fs@^0.223": "jsr:@std/fs@0.223.0", "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", - "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.1", - "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.1", - "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.1", - "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.1", + "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.4", + "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.4", + "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.4", + "jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4", "jsr:@std/io": "jsr:@std/io@0.223.0", "jsr:@std/io@^0.223": "jsr:@std/io@0.223.0", - "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.0", - "jsr:@std/path@1": "jsr:@std/path@1.0.2", + "jsr:@std/jsonc@^1.0.0": "jsr:@std/jsonc@1.0.1", + "jsr:@std/path@1": "jsr:@std/path@1.0.6", "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", "jsr:@std/path@^0.223": "jsr:@std/path@0.223.0", - "jsr:@std/path@^0.223.0": "jsr:@std/path@0.223.0", "jsr:@std/path@^0.225.2": "jsr:@std/path@0.225.2", - "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.2", - "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.2", - "jsr:@std/streams@^1.0.0": "jsr:@std/streams@1.0.1", + "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.6": "jsr:@std/path@1.0.6", "jsr:@std/testing@^1.0.0": "jsr:@std/testing@1.0.0", "jsr:@ts-morph/bootstrap@^0.24.0": "jsr:@ts-morph/bootstrap@0.24.0", "jsr:@ts-morph/common@^0.24.0": "jsr:@ts-morph/common@0.24.0", - "npm:@openapitools/openapi-generator-cli@2.13.4": "npm:@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", - "npm:@openapitools/openapi-generator-cli@2.13.5": "npm:@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", + "npm:@openapitools/openapi-generator-cli@2.13.12": "npm:@openapitools/openapi-generator-cli@2.13.12_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.7_rxjs@7.8.1_reflect-metadata@0.1.13", "npm:@types/node": "npm:@types/node@18.16.19", - "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.4", - "npm:axios@^1.7.3": "npm:axios@1.7.4", + "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.7", + "npm:axios@^1.7.3": "npm:axios@1.7.7", "npm:fetch-blob@^4.0.0": "npm:fetch-blob@4.0.0", "npm:fetch-mock@^11.1.3": "npm:fetch-mock@11.1.3", - "npm:typedoc@0.25.13": "npm:typedoc@0.25.13_typescript@5.4.5", - "npm:typedoc@0.26.6": "npm:typedoc@0.26.6_typescript@5.5.4", + "npm:typedoc@0.26.7": "npm:typedoc@0.26.7_typescript@5.5.4", "npm:typescript@^5.4.5": "npm:typescript@5.5.4" }, "jsr": { @@ -57,7 +48,6 @@ "@deno/cache-dir@0.10.3": { "integrity": "eb022f84ecc49c91d9d98131c6e6b118ff63a29e343624d058646b9d50404776", "dependencies": [ - "jsr:@deno/graph@^0.73.1", "jsr:@std/fmt@^0.223", "jsr:@std/fs@^0.223", "jsr:@std/io@^0.223", @@ -75,20 +65,11 @@ "jsr:@ts-morph/bootstrap@^0.24.0" ] }, - "@deno/graph@0.73.1": { - "integrity": "cd69639d2709d479037d5ce191a422eabe8d71bb68b0098344f6b07411c84d41" - }, "@std/assert@0.223.0": { - "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24", - "dependencies": [ - "jsr:@std/fmt@^0.223.0" - ] + "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24" }, "@std/assert@0.226.0": { - "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3", - "dependencies": [ - "jsr:@std/internal@^1.0.0" - ] + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3" }, "@std/assert@1.0.2": { "integrity": "ccacec332958126deaceb5c63ff8b4eaf9f5ed0eac9feccf124110435e59e49c", @@ -96,33 +77,23 @@ "jsr:@std/internal@^1.0.1" ] }, - "@std/async@1.0.3": { - "integrity": "6ed64678db43451683c6c176a21426a2ccd21ba0269ebb2c36133ede3f165792" + "@std/assert@1.0.6": { + "integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207", + "dependencies": [ + "jsr:@std/internal@^1.0.4" + ] }, "@std/bytes@0.223.0": { "integrity": "84b75052cd8680942c397c2631318772b295019098f40aac5c36cead4cba51a8" }, - "@std/bytes@1.0.2": { - "integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57" - }, - "@std/data-structures@1.0.1": { - "integrity": "e4fa6bcc33839979ac118e2746f349cd7b57c58bd3036b5b82ac608771ee856e" - }, "@std/fmt@0.223.0": { "integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208" }, - "@std/fmt@0.225.3": { - "integrity": "cb6ea567155f9865b80b502b2dde7671803eddd6dad743d8851d0de2c40bd349" - }, - "@std/fmt@1.0.0": { - "integrity": "8a95c9fdbb61559418ccbc0f536080cf43341655e1444f9d375a66886ceaaa3d" + "@std/fmt@1.0.2": { + "integrity": "87e9dfcdd3ca7c066e0c3c657c1f987c82888eb8103a3a3baa62684ffeb0f7a7" }, "@std/fs@0.223.0": { - "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c", - "dependencies": [ - "jsr:@std/assert@^0.223.0", - "jsr:@std/path@^0.223.0" - ] + "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c" }, "@std/fs@0.229.3": { "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", @@ -130,18 +101,18 @@ "jsr:@std/path@1.0.0-rc.1" ] }, - "@std/fs@1.0.1": { - "integrity": "d6914ca2c21abe591f733b31dbe6331e446815e513e2451b3b9e472daddfefcb", + "@std/fs@1.0.4": { + "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", "dependencies": [ - "jsr:@std/path@^1.0.2" + "jsr:@std/path@^1.0.6" ] }, - "@std/internal@1.0.0": { - "integrity": "ac6a6dfebf838582c4b4f61a6907374e27e05bedb6ce276e0f1608fe84e7cd9a" - }, "@std/internal@1.0.1": { "integrity": "6f8c7544d06a11dd256c8d6ba54b11ed870aac6c5aeafff499892662c57673e6" }, + "@std/internal@1.0.4": { + "integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422" + }, "@std/io@0.223.0": { "integrity": "2d8c3c2ab3a515619b90da2c6ff5ea7b75a94383259ef4d02116b228393f84f1", "dependencies": [ @@ -149,8 +120,8 @@ "jsr:@std/bytes@^0.223.0" ] }, - "@std/jsonc@1.0.0": { - "integrity": "835da212e586f3ef94ab25e8f0e8a7711a86fddbee95ad40c34d6b3d74da1a1b" + "@std/jsonc@1.0.1": { + "integrity": "6b36956e2a7cbb08ca5ad7fbec72e661e6217c202f348496ea88747636710dda" }, "@std/path@0.223.0": { "integrity": "593963402d7e6597f5a6e620931661053572c982fc014000459edc1f93cc3989", @@ -167,31 +138,13 @@ "@std/path@1.0.0-rc.1": { "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" }, - "@std/path@1.0.2": { - "integrity": "a452174603f8c620bd278a380c596437a9eef50c891c64b85812f735245d9ec7" - }, - "@std/streams@1.0.1": { - "integrity": "b07008b83fd7ae08965920d0fd700e07caf233bdd81e0ef1c8cca6c4140da364", - "dependencies": [ - "jsr:@std/bytes@^1.0.2-rc.3" - ] - }, - "@std/testing@0.225.0": { - "integrity": "53ca3c47eb121acabda633fd50699c4b33da6a7ce3e5bb34d7277d15df5f0a6e", - "dependencies": [ - "jsr:@std/assert@^0.226.0", - "jsr:@std/fmt@^0.225.3", - "jsr:@std/fs@^0.229.1", - "jsr:@std/internal@^1.0.0", - "jsr:@std/path@^0.225.2" - ] + "@std/path@1.0.6": { + "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" }, "@std/testing@1.0.0": { "integrity": "27cfc06392c69c2acffe54e6d0bcb5f961cf193f519255372bd4fff1481bfef8", "dependencies": [ "jsr:@std/assert@^1.0.2", - "jsr:@std/async@^1.0.2", - "jsr:@std/data-structures@^1.0.1", "jsr:@std/fs@^1.0.1", "jsr:@std/internal@^1.0.1", "jsr:@std/path@^1.0.2" @@ -212,8 +165,8 @@ } }, "npm": { - "@babel/runtime@7.24.6": { - "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "@babel/runtime@7.25.7": { + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dependencies": { "regenerator-runtime": "regenerator-runtime@0.14.1" } @@ -222,43 +175,35 @@ "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", "dependencies": {} }, - "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", + "@nestjs/axios@3.0.3_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.7_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-h6TCn3yJwD6OKqqqfmtRS5Zo4E46Ip2n+gK1sqwzNBC+qxQ9xpCu+ODVRFur6V3alHSCSBxb3nNtt73VEdluyA==", "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "axios": "axios@1.6.8", + "@nestjs/common": "@nestjs/common@10.4.3_reflect-metadata@0.1.13_rxjs@7.8.1", + "axios": "axios@1.7.7", "rxjs": "rxjs@7.8.1" } }, - "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", - "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "axios": "axios@1.7.4", - "rxjs": "rxjs@7.8.1" - } - }, - "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1": { - "integrity": "sha512-DGv34UHsZBxCM3H5QGE2XE/+oLJzz5+714JQjBhjD9VccFlQs3LRxo/epso4l7nJIiNlZkPyIUC8WzfU/5RTsQ==", + "@nestjs/common@10.4.3_reflect-metadata@0.1.13_rxjs@7.8.1": { + "integrity": "sha512-4hbLd3XIJubHSylYd/1WSi4VQvG68KM/ECYpMDqA3k3J1/T17SAg40sDoq3ZoO5OZgU0xuNyjuISdOTjs11qVg==", "dependencies": { "iterare": "iterare@1.2.1", "reflect-metadata": "reflect-metadata@0.1.13", "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2", + "tslib": "tslib@2.7.0", "uid": "uid@2.0.2" } }, - "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1": { - "integrity": "sha512-N06P5ncknW/Pm8bj964WvLIZn2gNhHliCBoAO1LeBvNImYkecqKcrmLbY49Fa1rmMfEM3MuBHeDys3edeuYAOA==", + "@nestjs/core@10.4.3_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1": { + "integrity": "sha512-6OQz+5C8mT8yRtfvE5pPCq+p6w5jDot+oQku1KzQ24ABn+lay1KGuJwcKZhdVNuselx+8xhdMxknZTA8wrGLIg==", "dependencies": { - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nestjs/common": "@nestjs/common@10.4.3_reflect-metadata@0.1.13_rxjs@7.8.1", "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", "fast-safe-stringify": "fast-safe-stringify@2.1.1", "iterare": "iterare@1.2.1", - "path-to-regexp": "path-to-regexp@3.2.0", + "path-to-regexp": "path-to-regexp@3.3.0", "reflect-metadata": "reflect-metadata@0.1.13", "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2", + "tslib": "tslib@2.7.0", "uid": "uid@2.0.2" } }, @@ -270,14 +215,14 @@ "node-fetch": "node-fetch@2.7.0" } }, - "@openapitools/openapi-generator-cli@2.13.4_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-4JKyrk55ohQK2FcuZbPdNvxdyXD14jjOIvE8hYjJ+E1cHbRbfXQXbYnjTODFE52Gx8eAxz8C9icuhDYDLn7nww==", + "@openapitools/openapi-generator-cli@2.13.12_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.7_rxjs@7.8.1_reflect-metadata@0.1.13": { + "integrity": "sha512-ieYnbFiSYAEXmmLea+BLh50kMCnUxUoMfElKvFNFPkK8xDCFIzdsa5OVfR/gUKJRuWz/znbEF+zIY3rXlBT+3Q==", "dependencies": { - "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.6.8_rxjs@7.8.1_reflect-metadata@0.1.13", - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nestjs/axios": "@nestjs/axios@3.0.3_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.7_rxjs@7.8.1_reflect-metadata@0.1.13", + "@nestjs/common": "@nestjs/common@10.4.3_reflect-metadata@0.1.13_rxjs@7.8.1", + "@nestjs/core": "@nestjs/core@10.4.3_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", - "axios": "axios@1.6.8", + "axios": "axios@1.7.7", "chalk": "chalk@4.1.2", "commander": "commander@8.3.0", "compare-versions": "compare-versions@4.1.4", @@ -285,46 +230,49 @@ "console.table": "console.table@0.10.0", "fs-extra": "fs-extra@10.1.0", "glob": "glob@7.2.3", - "https-proxy-agent": "https-proxy-agent@7.0.4", + "https-proxy-agent": "https-proxy-agent@7.0.5", "inquirer": "inquirer@8.2.6", "lodash": "lodash@4.17.21", "reflect-metadata": "reflect-metadata@0.1.13", "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2" + "tslib": "tslib@2.7.0" } }, - "@openapitools/openapi-generator-cli@2.13.5_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13": { - "integrity": "sha512-9VgeKOTiiatKSwZDKKB3C86cW8tN9eDcFohotD4eisdK38UQswk/4Ysoq9KChRCbymjoMp6AIDHPtK1DQ2fTgw==", + "@shikijs/core@1.21.0": { + "integrity": "sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==", "dependencies": { - "@nestjs/axios": "@nestjs/axios@3.0.2_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.4_rxjs@7.8.1_reflect-metadata@0.1.13", - "@nestjs/common": "@nestjs/common@10.3.0_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nestjs/core": "@nestjs/core@10.3.0_@nestjs+common@10.3.0__reflect-metadata@0.1.13__rxjs@7.8.1_reflect-metadata@0.1.13_rxjs@7.8.1", - "@nuxtjs/opencollective": "@nuxtjs/opencollective@0.3.2", - "axios": "axios@1.7.4", - "chalk": "chalk@4.1.2", - "commander": "commander@8.3.0", - "compare-versions": "compare-versions@4.1.4", - "concurrently": "concurrently@6.5.1", - "console.table": "console.table@0.10.0", - "fs-extra": "fs-extra@10.1.0", - "glob": "glob@7.2.3", - "https-proxy-agent": "https-proxy-agent@7.0.4", - "inquirer": "inquirer@8.2.6", - "lodash": "lodash@4.17.21", - "reflect-metadata": "reflect-metadata@0.1.13", - "rxjs": "rxjs@7.8.1", - "tslib": "tslib@2.6.2" + "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", + "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "@types/hast": "@types/hast@3.0.4", + "hast-util-to-html": "hast-util-to-html@9.0.3" + } + }, + "@shikijs/engine-javascript@1.21.0": { + "integrity": "sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==", + "dependencies": { + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", + "oniguruma-to-js": "oniguruma-to-js@0.4.3" } }, - "@shikijs/core@1.16.1": { - "integrity": "sha512-aI0hBtw+a6KsJp2jcD4YuQqKpeCbURMZbhHVozDknJpm+KJqeMRkEnfBC8BaKE/5XC+uofPgCLsa/TkTk0Ba0w==", + "@shikijs/engine-oniguruma@1.21.0": { + "integrity": "sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==", "dependencies": { - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2" + } + }, + "@shikijs/types@1.21.0": { + "integrity": "sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==", + "dependencies": { + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", "@types/hast": "@types/hast@3.0.4" } }, - "@shikijs/vscode-textmate@9.2.0": { - "integrity": "sha512-5FinaOp6Vdh/dl4/yaOTh0ZeKch+rYS8DUb38V3GMKYVkdqzxw53lViRKUYkVILRiVQT7dcPC7VvAKOR73zVtQ==", + "@shikijs/vscode-textmate@9.2.2": { + "integrity": "sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==", "dependencies": {} }, "@types/glob-to-regexp@0.4.4": { @@ -337,6 +285,12 @@ "@types/unist": "@types/unist@3.0.3" } }, + "@types/mdast@4.0.4": { + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3" + } + }, "@types/node@18.16.19": { "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "dependencies": {} @@ -345,10 +299,14 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "dependencies": {} }, + "@ungap/structured-clone@1.2.0": { + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dependencies": {} + }, "agent-base@7.1.1": { "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dependencies": { - "debug": "debug@4.3.5" + "debug": "debug@4.3.7" } }, "ansi-escapes@4.3.2": { @@ -361,10 +319,6 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dependencies": {} }, - "ansi-sequence-parser@1.1.1": { - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dependencies": {} - }, "ansi-styles@4.3.0": { "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dependencies": { @@ -379,26 +333,18 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dependencies": {} }, - "axios-mock-adapter@2.0.0_axios@1.7.4": { + "axios-mock-adapter@2.0.0_axios@1.7.7": { "integrity": "sha512-D/K0J5Zm6KvaMTnsWrBQZWLzKN9GxUFZEa0mx2qeEHXDeTugCoplWehy8y36dj5vuSjhe1u/Dol8cZ8lzzmDew==", "dependencies": { - "axios": "axios@1.7.4", + "axios": "axios@1.7.7", "fast-deep-equal": "fast-deep-equal@3.1.3", "is-buffer": "is-buffer@2.0.5" } }, - "axios@1.6.8": { - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", - "dependencies": { - "follow-redirects": "follow-redirects@1.15.6", - "form-data": "form-data@4.0.0", - "proxy-from-env": "proxy-from-env@1.1.0" - } - }, - "axios@1.7.4": { - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "axios@1.7.7": { + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "dependencies": { - "follow-redirects": "follow-redirects@1.15.6", + "follow-redirects": "follow-redirects@1.15.8", "form-data": "form-data@4.0.0", "proxy-from-env": "proxy-from-env@1.1.0" } @@ -439,6 +385,10 @@ "ieee754": "ieee754@1.2.1" } }, + "ccount@2.0.1": { + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dependencies": {} + }, "chalk@4.1.2": { "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dependencies": { @@ -446,6 +396,14 @@ "supports-color": "supports-color@7.2.0" } }, + "character-entities-html4@2.1.0": { + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dependencies": {} + }, + "character-entities-legacy@3.0.0": { + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dependencies": {} + }, "chardet@0.7.0": { "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dependencies": {} @@ -492,6 +450,10 @@ "delayed-stream": "delayed-stream@1.0.0" } }, + "comma-separated-tokens@2.0.3": { + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dependencies": {} + }, "commander@8.3.0": { "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", "dependencies": {} @@ -511,7 +473,7 @@ "date-fns": "date-fns@2.30.0", "lodash": "lodash@4.17.21", "rxjs": "rxjs@6.6.7", - "spawn-command": "spawn-command@0.0.2-1", + "spawn-command": "spawn-command@0.0.2", "supports-color": "supports-color@8.1.1", "tree-kill": "tree-kill@1.2.2", "yargs": "yargs@16.2.0" @@ -530,13 +492,13 @@ "date-fns@2.30.0": { "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", "dependencies": { - "@babel/runtime": "@babel/runtime@7.24.6" + "@babel/runtime": "@babel/runtime@7.25.7" } }, - "debug@4.3.5": { - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "debug@4.3.7": { + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "ms@2.1.2" + "ms": "ms@2.1.3" } }, "defaults@1.0.4": { @@ -553,6 +515,12 @@ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dependencies": {} }, + "devlop@1.1.0": { + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dependencies": { + "dequal": "dequal@2.0.3" + } + }, "easy-table@1.1.0": { "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", "dependencies": { @@ -567,8 +535,8 @@ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dependencies": {} }, - "escalade@3.1.2": { - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "escalade@3.2.0": { + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dependencies": {} }, "escape-string-regexp@1.0.5": { @@ -613,8 +581,8 @@ "escape-string-regexp": "escape-string-regexp@1.0.5" } }, - "follow-redirects@1.15.6": { - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "follow-redirects@1.15.8": { + "integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==", "dependencies": {} }, "form-data@4.0.0": { @@ -664,11 +632,37 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dependencies": {} }, - "https-proxy-agent@7.0.4": { - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "hast-util-to-html@9.0.3": { + "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", + "dependencies": { + "@types/hast": "@types/hast@3.0.4", + "@types/unist": "@types/unist@3.0.3", + "ccount": "ccount@2.0.1", + "comma-separated-tokens": "comma-separated-tokens@2.0.3", + "hast-util-whitespace": "hast-util-whitespace@3.0.0", + "html-void-elements": "html-void-elements@3.0.0", + "mdast-util-to-hast": "mdast-util-to-hast@13.2.0", + "property-information": "property-information@6.5.0", + "space-separated-tokens": "space-separated-tokens@2.0.2", + "stringify-entities": "stringify-entities@4.0.4", + "zwitch": "zwitch@2.0.4" + } + }, + "hast-util-whitespace@3.0.0": { + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dependencies": { + "@types/hast": "@types/hast@3.0.4" + } + }, + "html-void-elements@3.0.0": { + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "dependencies": {} + }, + "https-proxy-agent@7.0.5": { + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dependencies": { "agent-base": "agent-base@7.1.1", - "debug": "debug@4.3.5" + "debug": "debug@4.3.7" } }, "iconv-lite@0.4.24": { @@ -736,10 +730,6 @@ "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", "dependencies": {} }, - "jsonc-parser@3.2.1": { - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dependencies": {} - }, "jsonfile@6.1.0": { "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dependencies": { @@ -779,14 +769,51 @@ "uc.micro": "uc.micro@2.1.0" } }, - "marked@4.3.0": { - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "dependencies": {} + "mdast-util-to-hast@13.2.0": { + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dependencies": { + "@types/hast": "@types/hast@3.0.4", + "@types/mdast": "@types/mdast@4.0.4", + "@ungap/structured-clone": "@ungap/structured-clone@1.2.0", + "devlop": "devlop@1.1.0", + "micromark-util-sanitize-uri": "micromark-util-sanitize-uri@2.0.0", + "trim-lines": "trim-lines@3.0.1", + "unist-util-position": "unist-util-position@5.0.0", + "unist-util-visit": "unist-util-visit@5.0.0", + "vfile": "vfile@6.0.3" + } }, "mdurl@2.0.0": { "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dependencies": {} }, + "micromark-util-character@2.1.0": { + "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "dependencies": { + "micromark-util-symbol": "micromark-util-symbol@2.0.0", + "micromark-util-types": "micromark-util-types@2.0.0" + } + }, + "micromark-util-encode@2.0.0": { + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "dependencies": {} + }, + "micromark-util-sanitize-uri@2.0.0": { + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "dependencies": { + "micromark-util-character": "micromark-util-character@2.1.0", + "micromark-util-encode": "micromark-util-encode@2.0.0", + "micromark-util-symbol": "micromark-util-symbol@2.0.0" + } + }, + "micromark-util-symbol@2.0.0": { + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "dependencies": {} + }, + "micromark-util-types@2.0.0": { + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "dependencies": {} + }, "mime-db@1.52.0": { "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dependencies": {} @@ -813,8 +840,8 @@ "brace-expansion": "brace-expansion@2.0.1" } }, - "ms@2.1.2": { - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "ms@2.1.3": { + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dependencies": {} }, "mute-stream@0.0.8": { @@ -843,6 +870,12 @@ "mimic-fn": "mimic-fn@2.1.0" } }, + "oniguruma-to-js@0.4.3": { + "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", + "dependencies": { + "regex": "regex@4.3.3" + } + }, "ora@5.4.1": { "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dependencies": { @@ -865,8 +898,12 @@ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dependencies": {} }, - "path-to-regexp@3.2.0": { - "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==", + "path-to-regexp@3.3.0": { + "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", + "dependencies": {} + }, + "property-information@6.5.0": { + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", "dependencies": {} }, "proxy-from-env@1.1.0": { @@ -893,6 +930,10 @@ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "dependencies": {} }, + "regex@4.3.3": { + "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", + "dependencies": {} + }, "regexparam@3.0.0": { "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", "dependencies": {} @@ -921,7 +962,7 @@ "rxjs@7.8.1": { "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "dependencies": { - "tslib": "tslib@2.6.2" + "tslib": "tslib@2.7.0" } }, "safe-buffer@5.2.1": { @@ -932,20 +973,14 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dependencies": {} }, - "shiki@0.14.7": { - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", - "dependencies": { - "ansi-sequence-parser": "ansi-sequence-parser@1.1.1", - "jsonc-parser": "jsonc-parser@3.2.1", - "vscode-oniguruma": "vscode-oniguruma@1.7.0", - "vscode-textmate": "vscode-textmate@8.0.0" - } - }, - "shiki@1.16.1": { - "integrity": "sha512-tCJIMaxDVB1mEIJ5TvfZU7kCPB5eo9fli5+21Olc/bmyv+w8kye3JOp+LZRmGkAyT71hrkefQhTiY+o9mBikRQ==", + "shiki@1.21.0": { + "integrity": "sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==", "dependencies": { - "@shikijs/core": "@shikijs/core@1.16.1", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.0", + "@shikijs/core": "@shikijs/core@1.21.0", + "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", + "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", + "@shikijs/types": "@shikijs/types@1.21.0", + "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", "@types/hast": "@types/hast@3.0.4" } }, @@ -953,8 +988,12 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dependencies": {} }, - "spawn-command@0.0.2-1": { - "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "space-separated-tokens@2.0.2": { + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dependencies": {} + }, + "spawn-command@0.0.2": { + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", "dependencies": {} }, "string-width@4.2.3": { @@ -971,6 +1010,13 @@ "safe-buffer": "safe-buffer@5.2.1" } }, + "stringify-entities@4.0.4": { + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dependencies": { + "character-entities-html4": "character-entities-html4@2.1.0", + "character-entities-legacy": "character-entities-legacy@3.0.0" + } + }, "strip-ansi@6.0.1": { "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { @@ -1007,43 +1053,33 @@ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dependencies": {} }, + "trim-lines@3.0.1": { + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dependencies": {} + }, "tslib@1.14.1": { "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dependencies": {} }, - "tslib@2.6.2": { - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "tslib@2.7.0": { + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", "dependencies": {} }, "type-fest@0.21.3": { "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dependencies": {} }, - "typedoc@0.25.13_typescript@5.4.5": { - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", - "dependencies": { - "lunr": "lunr@2.3.9", - "marked": "marked@4.3.0", - "minimatch": "minimatch@9.0.5", - "shiki": "shiki@0.14.7", - "typescript": "typescript@5.4.5" - } - }, - "typedoc@0.26.6_typescript@5.5.4": { - "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", + "typedoc@0.26.7_typescript@5.5.4": { + "integrity": "sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==", "dependencies": { "lunr": "lunr@2.3.9", "markdown-it": "markdown-it@14.1.0", "minimatch": "minimatch@9.0.5", - "shiki": "shiki@1.16.1", + "shiki": "shiki@1.21.0", "typescript": "typescript@5.5.4", "yaml": "yaml@2.5.1" } }, - "typescript@5.4.5": { - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dependencies": {} - }, "typescript@5.5.4": { "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dependencies": {} @@ -1058,6 +1094,39 @@ "@lukeed/csprng": "@lukeed/csprng@1.1.0" } }, + "unist-util-is@6.0.0": { + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3" + } + }, + "unist-util-position@5.0.0": { + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3" + } + }, + "unist-util-stringify-position@4.0.0": { + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3" + } + }, + "unist-util-visit-parents@6.0.1": { + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "unist-util-is": "unist-util-is@6.0.0" + } + }, + "unist-util-visit@5.0.0": { + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "unist-util-is": "unist-util-is@6.0.0", + "unist-util-visit-parents": "unist-util-visit-parents@6.0.1" + } + }, "universalify@2.0.1": { "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dependencies": {} @@ -1066,13 +1135,19 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dependencies": {} }, - "vscode-oniguruma@1.7.0": { - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dependencies": {} + "vfile-message@4.0.2": { + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "unist-util-stringify-position": "unist-util-stringify-position@4.0.0" + } }, - "vscode-textmate@8.0.0": { - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dependencies": {} + "vfile@6.0.3": { + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dependencies": { + "@types/unist": "@types/unist@3.0.3", + "vfile-message": "vfile-message@4.0.2" + } }, "wcwidth@1.0.1": { "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", @@ -1127,13 +1202,17 @@ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dependencies": { "cliui": "cliui@7.0.4", - "escalade": "escalade@3.1.2", + "escalade": "escalade@3.2.0", "get-caller-file": "get-caller-file@2.0.5", "require-directory": "require-directory@2.1.1", "string-width": "string-width@4.2.3", "y18n": "y18n@5.0.8", "yargs-parser": "yargs-parser@20.2.9" } + }, + "zwitch@2.0.4": { + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dependencies": {} } } }, @@ -1142,7 +1221,7 @@ }, "workspace": { "dependencies": [ - "jsr:@deno/dnt@^0.41.2", + "jsr:@deno/dnt@^0.41.3", "jsr:@std/assert@^1.0.0", "jsr:@std/fs@^1.0.0", "jsr:@std/jsonc@^1.0.0", diff --git a/flake.nix b/flake.nix index e18baa4..60787e0 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,6 @@ # TODO(@joscha) change this once we only publish to jsr only nodejs_20 jre - openapi-generator-cli yamllint yamlfmt ]; From 2d86587664e040030565a9e7db5c2f80e73f79eb Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 2 Oct 2024 17:49:24 +0100 Subject: [PATCH 4/5] chore: more lock updates --- deno.lock | 365 ++++-------------------------------------------------- 1 file changed, 26 insertions(+), 339 deletions(-) diff --git a/deno.lock b/deno.lock index ab4d215..cb775ff 100644 --- a/deno.lock +++ b/deno.lock @@ -9,7 +9,10 @@ "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", "jsr:@std/assert@^1.0.0": "jsr:@std/assert@1.0.6", "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.6", + "jsr:@std/assert@^1.0.6": "jsr:@std/assert@1.0.6", + "jsr:@std/async@^1.0.5": "jsr:@std/async@1.0.5", "jsr:@std/bytes@^0.223.0": "jsr:@std/bytes@0.223.0", + "jsr:@std/data-structures@^1.0.4": "jsr:@std/data-structures@1.0.4", "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.2", "jsr:@std/fmt@^0.223": "jsr:@std/fmt@0.223.0", "jsr:@std/fs@1": "jsr:@std/fs@1.0.4", @@ -17,6 +20,7 @@ "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", "jsr:@std/fs@^1.0.0": "jsr:@std/fs@1.0.4", "jsr:@std/fs@^1.0.1": "jsr:@std/fs@1.0.4", + "jsr:@std/fs@^1.0.4": "jsr:@std/fs@1.0.4", "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.4", "jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4", "jsr:@std/io": "jsr:@std/io@0.223.0", @@ -29,17 +33,15 @@ "jsr:@std/path@^1.0.0": "jsr:@std/path@1.0.6", "jsr:@std/path@^1.0.2": "jsr:@std/path@1.0.6", "jsr:@std/path@^1.0.6": "jsr:@std/path@1.0.6", - "jsr:@std/testing@^1.0.0": "jsr:@std/testing@1.0.0", + "jsr:@std/testing@^1.0.0": "jsr:@std/testing@1.0.3", "jsr:@ts-morph/bootstrap@^0.24.0": "jsr:@ts-morph/bootstrap@0.24.0", "jsr:@ts-morph/common@^0.24.0": "jsr:@ts-morph/common@0.24.0", "npm:@openapitools/openapi-generator-cli@2.13.12": "npm:@openapitools/openapi-generator-cli@2.13.12_@nestjs+common@10.4.3__reflect-metadata@0.1.13__rxjs@7.8.1_axios@1.7.7_rxjs@7.8.1_reflect-metadata@0.1.13", "npm:@types/node": "npm:@types/node@18.16.19", - "npm:axios-mock-adapter@^2.0.0": "npm:axios-mock-adapter@2.0.0_axios@1.7.7", "npm:axios@^1.7.3": "npm:axios@1.7.7", "npm:fetch-blob@^4.0.0": "npm:fetch-blob@4.0.0", - "npm:fetch-mock@^11.1.3": "npm:fetch-mock@11.1.3", - "npm:typedoc@0.26.7": "npm:typedoc@0.26.7_typescript@5.5.4", - "npm:typescript@^5.4.5": "npm:typescript@5.5.4" + "npm:fetch-mock@^11.1.3": "npm:fetch-mock@11.1.5", + "npm:typescript@^5.4.5": "npm:typescript@5.6.2" }, "jsr": { "@david/code-block-writer@13.0.2": { @@ -83,9 +85,15 @@ "jsr:@std/internal@^1.0.4" ] }, + "@std/async@1.0.5": { + "integrity": "31d68214bfbb31bd4c6022401d484e3964147c76c9220098baa703a39b6c2da6" + }, "@std/bytes@0.223.0": { "integrity": "84b75052cd8680942c397c2631318772b295019098f40aac5c36cead4cba51a8" }, + "@std/data-structures@1.0.4": { + "integrity": "fa0e20c11eb9ba673417450915c750a0001405a784e2a4e0c3725031681684a0" + }, "@std/fmt@0.223.0": { "integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208" }, @@ -141,13 +149,15 @@ "@std/path@1.0.6": { "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" }, - "@std/testing@1.0.0": { - "integrity": "27cfc06392c69c2acffe54e6d0bcb5f961cf193f519255372bd4fff1481bfef8", + "@std/testing@1.0.3": { + "integrity": "f98c2bee53860a5916727d7e7d3abe920dd6f9edace022e2d059f00d05c2cf42", "dependencies": [ - "jsr:@std/assert@^1.0.2", - "jsr:@std/fs@^1.0.1", - "jsr:@std/internal@^1.0.1", - "jsr:@std/path@^1.0.2" + "jsr:@std/assert@^1.0.6", + "jsr:@std/async@^1.0.5", + "jsr:@std/data-structures@^1.0.4", + "jsr:@std/fs@^1.0.4", + "jsr:@std/internal@^1.0.4", + "jsr:@std/path@^1.0.6" ] }, "@ts-morph/bootstrap@0.24.0": { @@ -238,71 +248,14 @@ "tslib": "tslib@2.7.0" } }, - "@shikijs/core@1.21.0": { - "integrity": "sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==", - "dependencies": { - "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", - "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "@types/hast": "@types/hast@3.0.4", - "hast-util-to-html": "hast-util-to-html@9.0.3" - } - }, - "@shikijs/engine-javascript@1.21.0": { - "integrity": "sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==", - "dependencies": { - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "oniguruma-to-js": "oniguruma-to-js@0.4.3" - } - }, - "@shikijs/engine-oniguruma@1.21.0": { - "integrity": "sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==", - "dependencies": { - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2" - } - }, - "@shikijs/types@1.21.0": { - "integrity": "sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==", - "dependencies": { - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "@types/hast": "@types/hast@3.0.4" - } - }, - "@shikijs/vscode-textmate@9.2.2": { - "integrity": "sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==", - "dependencies": {} - }, "@types/glob-to-regexp@0.4.4": { "integrity": "sha512-nDKoaKJYbnn1MZxUY0cA1bPmmgZbg0cTq7Rh13d0KWYNOiKbqoR+2d89SnRPszGh7ROzSwZ/GOjZ4jPbmmZ6Eg==", "dependencies": {} }, - "@types/hast@3.0.4": { - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, - "@types/mdast@4.0.4": { - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, "@types/node@18.16.19": { "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "dependencies": {} }, - "@types/unist@3.0.3": { - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "dependencies": {} - }, - "@ungap/structured-clone@1.2.0": { - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dependencies": {} - }, "agent-base@7.1.1": { "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dependencies": { @@ -325,22 +278,10 @@ "color-convert": "color-convert@2.0.1" } }, - "argparse@2.0.1": { - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dependencies": {} - }, "asynckit@0.4.0": { "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dependencies": {} }, - "axios-mock-adapter@2.0.0_axios@1.7.7": { - "integrity": "sha512-D/K0J5Zm6KvaMTnsWrBQZWLzKN9GxUFZEa0mx2qeEHXDeTugCoplWehy8y36dj5vuSjhe1u/Dol8cZ8lzzmDew==", - "dependencies": { - "axios": "axios@1.7.7", - "fast-deep-equal": "fast-deep-equal@3.1.3", - "is-buffer": "is-buffer@2.0.5" - } - }, "axios@1.7.7": { "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "dependencies": { @@ -372,12 +313,6 @@ "concat-map": "concat-map@0.0.1" } }, - "brace-expansion@2.0.1": { - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "balanced-match@1.0.2" - } - }, "buffer@5.7.1": { "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "dependencies": { @@ -385,10 +320,6 @@ "ieee754": "ieee754@1.2.1" } }, - "ccount@2.0.1": { - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", - "dependencies": {} - }, "chalk@4.1.2": { "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dependencies": { @@ -396,14 +327,6 @@ "supports-color": "supports-color@7.2.0" } }, - "character-entities-html4@2.1.0": { - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", - "dependencies": {} - }, - "character-entities-legacy@3.0.0": { - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "dependencies": {} - }, "chardet@0.7.0": { "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dependencies": {} @@ -450,10 +373,6 @@ "delayed-stream": "delayed-stream@1.0.0" } }, - "comma-separated-tokens@2.0.3": { - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", - "dependencies": {} - }, "commander@8.3.0": { "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", "dependencies": {} @@ -515,12 +434,6 @@ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "dependencies": {} }, - "devlop@1.1.0": { - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", - "dependencies": { - "dequal": "dequal@2.0.3" - } - }, "easy-table@1.1.0": { "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", "dependencies": { @@ -531,10 +444,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dependencies": {} }, - "entities@4.5.0": { - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dependencies": {} - }, "escalade@3.2.0": { "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dependencies": {} @@ -551,10 +460,6 @@ "tmp": "tmp@0.0.33" } }, - "fast-deep-equal@3.1.3": { - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dependencies": {} - }, "fast-safe-stringify@2.1.1": { "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dependencies": {} @@ -565,8 +470,8 @@ "node-domexception": "node-domexception@1.0.0" } }, - "fetch-mock@11.1.3": { - "integrity": "sha512-ATh0dWgnVrUHiiXuvQm1Ry+ThWfSv1QQgqJTCtybrNxyUrFiSOaDKsNG29eyysp1SHeNP6Q+dH50+8VifN51Ig==", + "fetch-mock@11.1.5": { + "integrity": "sha512-KHmZDnZ1ry0pCTrX4YG5DtThHi0MH+GNI9caESnzX/nMJBrvppUHMvLx47M0WY9oAtKOMiPfZDRpxhlHg89BOA==", "dependencies": { "@types/glob-to-regexp": "@types/glob-to-regexp@0.4.4", "dequal": "dequal@2.0.3", @@ -632,32 +537,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dependencies": {} }, - "hast-util-to-html@9.0.3": { - "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", - "dependencies": { - "@types/hast": "@types/hast@3.0.4", - "@types/unist": "@types/unist@3.0.3", - "ccount": "ccount@2.0.1", - "comma-separated-tokens": "comma-separated-tokens@2.0.3", - "hast-util-whitespace": "hast-util-whitespace@3.0.0", - "html-void-elements": "html-void-elements@3.0.0", - "mdast-util-to-hast": "mdast-util-to-hast@13.2.0", - "property-information": "property-information@6.5.0", - "space-separated-tokens": "space-separated-tokens@2.0.2", - "stringify-entities": "stringify-entities@4.0.4", - "zwitch": "zwitch@2.0.4" - } - }, - "hast-util-whitespace@3.0.0": { - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", - "dependencies": { - "@types/hast": "@types/hast@3.0.4" - } - }, - "html-void-elements@3.0.0": { - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", - "dependencies": {} - }, "https-proxy-agent@7.0.5": { "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dependencies": { @@ -706,10 +585,6 @@ "wrap-ansi": "wrap-ansi@6.2.0" } }, - "is-buffer@2.0.5": { - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dependencies": {} - }, "is-fullwidth-code-point@3.0.0": { "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dependencies": {} @@ -737,12 +612,6 @@ "universalify": "universalify@2.0.1" } }, - "linkify-it@5.0.0": { - "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", - "dependencies": { - "uc.micro": "uc.micro@2.1.0" - } - }, "lodash@4.17.21": { "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dependencies": {} @@ -754,66 +623,6 @@ "is-unicode-supported": "is-unicode-supported@0.1.0" } }, - "lunr@2.3.9": { - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "dependencies": {} - }, - "markdown-it@14.1.0": { - "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", - "dependencies": { - "argparse": "argparse@2.0.1", - "entities": "entities@4.5.0", - "linkify-it": "linkify-it@5.0.0", - "mdurl": "mdurl@2.0.0", - "punycode.js": "punycode.js@2.3.1", - "uc.micro": "uc.micro@2.1.0" - } - }, - "mdast-util-to-hast@13.2.0": { - "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", - "dependencies": { - "@types/hast": "@types/hast@3.0.4", - "@types/mdast": "@types/mdast@4.0.4", - "@ungap/structured-clone": "@ungap/structured-clone@1.2.0", - "devlop": "devlop@1.1.0", - "micromark-util-sanitize-uri": "micromark-util-sanitize-uri@2.0.0", - "trim-lines": "trim-lines@3.0.1", - "unist-util-position": "unist-util-position@5.0.0", - "unist-util-visit": "unist-util-visit@5.0.0", - "vfile": "vfile@6.0.3" - } - }, - "mdurl@2.0.0": { - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", - "dependencies": {} - }, - "micromark-util-character@2.1.0": { - "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", - "dependencies": { - "micromark-util-symbol": "micromark-util-symbol@2.0.0", - "micromark-util-types": "micromark-util-types@2.0.0" - } - }, - "micromark-util-encode@2.0.0": { - "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", - "dependencies": {} - }, - "micromark-util-sanitize-uri@2.0.0": { - "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", - "dependencies": { - "micromark-util-character": "micromark-util-character@2.1.0", - "micromark-util-encode": "micromark-util-encode@2.0.0", - "micromark-util-symbol": "micromark-util-symbol@2.0.0" - } - }, - "micromark-util-symbol@2.0.0": { - "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", - "dependencies": {} - }, - "micromark-util-types@2.0.0": { - "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", - "dependencies": {} - }, "mime-db@1.52.0": { "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dependencies": {} @@ -834,12 +643,6 @@ "brace-expansion": "brace-expansion@1.1.11" } }, - "minimatch@9.0.5": { - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dependencies": { - "brace-expansion": "brace-expansion@2.0.1" - } - }, "ms@2.1.3": { "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dependencies": {} @@ -870,12 +673,6 @@ "mimic-fn": "mimic-fn@2.1.0" } }, - "oniguruma-to-js@0.4.3": { - "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", - "dependencies": { - "regex": "regex@4.3.3" - } - }, "ora@5.4.1": { "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dependencies": { @@ -902,18 +699,10 @@ "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", "dependencies": {} }, - "property-information@6.5.0": { - "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", - "dependencies": {} - }, "proxy-from-env@1.1.0": { "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "dependencies": {} }, - "punycode.js@2.3.1": { - "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", - "dependencies": {} - }, "readable-stream@3.6.2": { "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { @@ -930,10 +719,6 @@ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "dependencies": {} }, - "regex@4.3.3": { - "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", - "dependencies": {} - }, "regexparam@3.0.0": { "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", "dependencies": {} @@ -973,25 +758,10 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dependencies": {} }, - "shiki@1.21.0": { - "integrity": "sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==", - "dependencies": { - "@shikijs/core": "@shikijs/core@1.21.0", - "@shikijs/engine-javascript": "@shikijs/engine-javascript@1.21.0", - "@shikijs/engine-oniguruma": "@shikijs/engine-oniguruma@1.21.0", - "@shikijs/types": "@shikijs/types@1.21.0", - "@shikijs/vscode-textmate": "@shikijs/vscode-textmate@9.2.2", - "@types/hast": "@types/hast@3.0.4" - } - }, "signal-exit@3.0.7": { "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dependencies": {} }, - "space-separated-tokens@2.0.2": { - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "dependencies": {} - }, "spawn-command@0.0.2": { "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", "dependencies": {} @@ -1010,13 +780,6 @@ "safe-buffer": "safe-buffer@5.2.1" } }, - "stringify-entities@4.0.4": { - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", - "dependencies": { - "character-entities-html4": "character-entities-html4@2.1.0", - "character-entities-legacy": "character-entities-legacy@3.0.0" - } - }, "strip-ansi@6.0.1": { "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { @@ -1053,10 +816,6 @@ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dependencies": {} }, - "trim-lines@3.0.1": { - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", - "dependencies": {} - }, "tslib@1.14.1": { "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dependencies": {} @@ -1069,23 +828,8 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dependencies": {} }, - "typedoc@0.26.7_typescript@5.5.4": { - "integrity": "sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==", - "dependencies": { - "lunr": "lunr@2.3.9", - "markdown-it": "markdown-it@14.1.0", - "minimatch": "minimatch@9.0.5", - "shiki": "shiki@1.21.0", - "typescript": "typescript@5.5.4", - "yaml": "yaml@2.5.1" - } - }, - "typescript@5.5.4": { - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", - "dependencies": {} - }, - "uc.micro@2.1.0": { - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "typescript@5.6.2": { + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dependencies": {} }, "uid@2.0.2": { @@ -1094,39 +838,6 @@ "@lukeed/csprng": "@lukeed/csprng@1.1.0" } }, - "unist-util-is@6.0.0": { - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, - "unist-util-position@5.0.0": { - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, - "unist-util-stringify-position@4.0.0": { - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3" - } - }, - "unist-util-visit-parents@6.0.1": { - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-is": "unist-util-is@6.0.0" - } - }, - "unist-util-visit@5.0.0": { - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-is": "unist-util-is@6.0.0", - "unist-util-visit-parents": "unist-util-visit-parents@6.0.1" - } - }, "universalify@2.0.1": { "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dependencies": {} @@ -1135,20 +846,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dependencies": {} }, - "vfile-message@4.0.2": { - "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "unist-util-stringify-position": "unist-util-stringify-position@4.0.0" - } - }, - "vfile@6.0.3": { - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", - "dependencies": { - "@types/unist": "@types/unist@3.0.3", - "vfile-message": "vfile-message@4.0.2" - } - }, "wcwidth@1.0.1": { "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dependencies": { @@ -1190,10 +887,6 @@ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dependencies": {} }, - "yaml@2.5.1": { - "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", - "dependencies": {} - }, "yargs-parser@20.2.9": { "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dependencies": {} @@ -1209,16 +902,10 @@ "y18n": "y18n@5.0.8", "yargs-parser": "yargs-parser@20.2.9" } - }, - "zwitch@2.0.4": { - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", - "dependencies": {} } } }, - "remote": { - "https://deno.land/x/keypress@0.0.11/mod.ts": "22fe0ea62136f3015149c639f891076a5b2312c0b8974c4a2bd8acaaded61c61" - }, + "remote": {}, "workspace": { "dependencies": [ "jsr:@deno/dnt@^0.41.3", From a6af9c32892c0bca095a8ec2e1d9deeaba20fdec Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 2 Oct 2024 17:50:04 +0100 Subject: [PATCH 5/5] chore: update flake.lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/e46dc3b8343f627532ba881965b053d3bbec4235' (2024-10-02) → 'github:NixOS/nixpkgs/f20c12dd290c1a9b81f4243c68b82bb7756883d9' (2024-10-02) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 29d43b4..73e4003 100644 --- a/flake.lock +++ b/flake.lock @@ -57,11 +57,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727872001, - "narHash": "sha256-nZNSePIWw526864XBqsrWU1dbo4Ei8iJXpNHCubui28=", + "lastModified": 1727887484, + "narHash": "sha256-B+8SFZeIlM1UjPuFsvRMAh5g1nn+fftetwb+n8sgx4g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e46dc3b8343f627532ba881965b053d3bbec4235", + "rev": "f20c12dd290c1a9b81f4243c68b82bb7756883d9", "type": "github" }, "original": {