{"id":25961706,"url":"https://github.com/ttab/typescript-api-client","last_synced_at":"2026-05-16T13:08:21.096Z","repository":{"id":36547715,"uuid":"170879958","full_name":"ttab/typescript-api-client","owner":"ttab","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-17T12:09:20.000Z","size":946,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-21T04:10:01.184Z","etag":null,"topics":["jest","library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-15T14:45:46.000Z","updated_at":"2025-06-17T12:09:23.000Z","dependencies_parsed_at":"2024-03-26T11:26:17.724Z","dependency_job_id":"356a0f02-ff33-4d77-bc12-73e0e625c19c","html_url":"https://github.com/ttab/typescript-api-client","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/ttab/typescript-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftypescript-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftypescript-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftypescript-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftypescript-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttab","download_url":"https://codeload.github.com/ttab/typescript-api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftypescript-api-client/sbom","scorecard":{"id":901358,"data":{"date":"2025-08-11","repo":{"name":"github.com/ttab/typescript-api-client","commit":"2ab2dfcdff0a6a429430b9b4b7bd17f151af666c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T15:41:25.432Z","repository_id":36547715,"created_at":"2025-08-24T15:41:25.432Z","updated_at":"2025-08-24T15:41:25.432Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33104007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","library"],"created_at":"2025-03-04T19:41:01.674Z","updated_at":"2026-05-16T13:08:21.073Z","avatar_url":"https://github.com/ttab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @ttab/api-client\n\nBrowser-friendly TypeScript client for TT Nyhetsbyrån public APIs. The client\ncode (and this README file) has been automatically generated from the API\ndefinition located at [https://api.tt.se/docs](https://api.tt.se/docs).\n\n![Version](http://img.shields.io/npm/v/@ttab/api-client.svg) \u0026nbsp;\n![License](http://img.shields.io/npm/l/@ttab/api-client.svg) \u0026nbsp;\n![Monthly downloads](http://img.shields.io/npm/dm/@ttab/api-client.svg) \u0026nbsp;\n\nInstructions for building the client are [here](/BUILDING.md).\n\n- [Getting started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Obtaining an OAuth2 token](#obtaining-an-oauth2-token)\n  - [Searching](#searching)\n  - [Streaming data](#streaming-data)\n    - [The ContentStream class](#the-contentstream-class)\n- [API Reference](#api-reference)\n  - ContentV1\n    - [search](#searchmediatype-parameters)\n    - [stream](#streammediatype-parameters)\n    - [getNotifications](#getnotificationsmediatype)\n    - [addNotificationMobile](#addnotificationmobilemediatype-parameters)\n    - [addNotificationEmail](#addnotificationemailmediatype-parameters)\n    - [addNotificationScheduledEmail](#addnotificationscheduledemailmediatype-parameters)\n    - [addNotificationStream](#addnotificationstreammediatype-parameters)\n    - [updateNotificationMobile](#updatenotificationmobilemediatype-id-parameters)\n    - [updateNotificationEmail](#updatenotificationemailmediatype-id-parameters)\n    - [updateNotificationScheduledEmail](#updatenotificationscheduledemailmediatype-id-parameters)\n    - [updateNotificationStream](#updatenotificationstreammediatype-id-parameters)\n    - [getNotificationStream](#getnotificationstreammediatype-id-parameters)\n    - [removeNotification](#removenotificationmediatype-id)\n  - UserV1\n    - [getAgreements](#getagreements)\n    - [getOrder](#getorderparameters)\n    - [updateOrder](#updateorderid-order)\n    - [getProfile](#getprofile)\n    - [updateProfile](#updateprofileprofile)\n    - [getProfileByProperty](#getprofilebypropertyproperty)\n    - [updateProfileByProperty](#updateprofilebypropertyproperty-profile)\n    - [updateDevice](#updatedevicetoken-parameters)\n    - [removeDevice](#removedevicetoken)\n    - [getOrganization](#getorganization)\n    - [getOrganizationUsers](#getorganizationusers)\n    - [addOrganizationUser](#addorganizationuseruser)\n    - [getOrganizationUser](#getorganizationuserid)\n    - [updateOrganizationUser](#updateorganizationuserid-user)\n    - [getUser](#getuser)\n  - CollectionV1\n    - [getCollections](#getcollections)\n    - [addCollection](#addcollectioncollection)\n    - [getCollection](#getcollectionid)\n    - [updateCollection](#updatecollectionid-collection)\n    - [removeCollection](#removecollectionid)\n    - [addCollectionItems](#addcollectionitemsid-items)\n    - [removeCollectionItems](#removecollectionitemsid-items)\n  - [Exported types](#exported-types)\n    - [ttninjs](#interface-ttninjs)\n    - [access](#interface-access)\n    - [address](#interface-address)\n    - [agreement](#interface-agreement)\n    - [agreement2](#interface-agreement2)\n    - [agreementType](#interface-agreementType)\n    - [collection](#interface-collection)\n    - [collectionItem](#interface-collectionItem)\n    - [error](#interface-error)\n    - [errors](#interface-errors)\n    - [facet](#interface-facet)\n    - [license](#interface-license)\n    - [monetaryAmount](#interface-monetaryAmount)\n    - [order](#interface-order)\n    - [notification](#interface-notification)\n    - [organization](#interface-organization)\n    - [phoneNumber](#interface-phoneNumber)\n    - [phoneNumberDirect](#interface-phoneNumberDirect)\n    - [product](#interface-product)\n    - [product2](#interface-product2)\n    - [user](#interface-user)\n    - [userBase](#interface-userBase)\n    - [contactinfoType](#interface-contactinfoType)\n\n# Getting started\n\n## Prerequisites\n\nTo access the APIs you need to have a registered user account at\n[TT Nyhetsbyrån](https://tt.se).\n\nThe API uses OAuth2 token authentication. To be able to generate an OAuth2 token\nyou will need a OAuth2 client registered with TT Nyhetsbyrån. If you don't have\none, please contact [support@tt.se](mailto:support@tt.se).\n\n## Obtaining an OAuth2 token\n\nThe OAuth2 endpoints are documented\n[here](http://spec.tt.se/api.html#authentication). In short, to obtain a token\nyou call the `https://tt.se/o/oauth2/token` endpoint like this:\n\n```sh\ncurl -XPOST -d username=\"\u003cUSERNAME\u003e\" \\\n  -d password=\"\u003cPASSWORD\u003e\" \\\n  -d grant_type=password \\\n  -d scope=\"roles\" \\\n  -d client_id=\"\u003cCLIENT_ID\u003e\" \\\n  -d client_secret=\"\u003cCLIENT_SECRET\u003e\" \\\n  https://tt.se/o/oauth2/token\n```\n\nYou will get a JSON payload back. One of the properties is called `access_token`\nand contains the the OAuth2 token you need to connect to the API. To run the\nexamples below it is handy to have this token exported as an environment\nvariable:\n\n```sh\nexport TOKEN=\"a.DV_8caPCk7CVQs_jr4_MpqZSxj4e25N3GbTEGXk2w4MUwzB...\"\n```\n\n## Searching\n\nSearching the database for matching items is a common operation. You supply the\n`mediaType` (`image`, `text`, `video`, etc.) and an object with query\nparameters, and get a result object with an array of search `hits`.\n\nThis is a basic query, looking for panda pictures:\n\n```typescript\nimport { Api } from '@ttab/api-client'\n\nlet api = new Api({ token: process.env.TOKEN || '' })\n\napi.content.search('image', { q: 'panda' }).then((res) =\u003e {\n  res.hits.forEach((hit) =\u003e {\n    console.log(hit.uri, hit.product)\n  })\n})\n```\n\nThe search result is restricted to only match items allowed by the customer\nagreements linked to your user account. If you wish to further restrict the\nsearch result to match a given agreement you can use the `agr` parameter:\n\n```typescript\napi.content.search('image', { q: 'panda', agr: [20031] }).then((res) =\u003e {\n  res.hits.forEach((hit) =\u003e {\n    console.log(hit.uri, hit.product)\n  })\n})\n```\n\nYou can also restrict the search result to only contain items matching one or\nmore [product codes](https://tt.se/spec/product/1.0):\n\n```typescript\napi.content\n  .search('image', { q: 'panda', p: ['FOGNRE', 'FOGNREEJ'] })\n  .then((res) =\u003e {\n    res.hits.forEach((hit) =\u003e {\n      console.log(hit.uri, hit.product)\n    })\n  })\n```\n\n## Streaming data\n\nWhile the [api.content.search()](#searchmediatype-parameters) method only\nreturns items that are already present in the database, the notification stream\nendpoint provides a way to get a near real-time stream of new items as they are\nbeing indexed.\n\nYou first need to create a notification stream by calling\n[api.content.addNotificationStream()](#addnotificationstreammediatype-parameters),\nwhich accepts roughly the same arguments as\n[api.content.search()](#searchmediatype-parameters) with the exception of\narguments that affect time ranges and result pagination. They don't make any\nsense while streaming data, as we will always return the latest items added.\n\nNotification streams support streaming content using the `_all` media type,\nsomethihg that the now-deprecated streaming method\n[api.content.stream](#streammediatype-parameters) had problems with.\n\nBy calling\n[api.content.getNotificationStream()](#getnotificationstreammediatype-id-parameters),\nwith the ID of the newly created stream you will receive new items matching the\nsearch criteria as they are being indexed into the database. This is a HTTP\nlong-poll call, which will hang until one or more items are available or the\ntimeout (specified with the `wait` paramter; default 60s) is reached, whichever\ncomes first.\n\nNote that the state of the stream is kept server-side, so repeated calls to\nfetch items from the stream will yield different results.\n\nNotification streams expire after 5 minutes of client inactivity. Calling\n[api.content.getNotificationStream](#getnotificationstreammediatype-id-parameters)\non an expired stream will yield HTTP 404.\n\nThis is a an simplified example streaming all `text` items. For production use\nyou would probably want some better error handling logic.\n\n```typescript\nimport { Api } from '@ttab/api-client'\n\nlet api = new Api({ token: process.env.TOKEN || '' })\n\napi.content\n  .addNotificationStream('text', {})\n  .then((stream) =\u003e {\n    function loop() {\n      return api.content\n        .getNotificationStream('text', stream.id, {})\n        .then((result) =\u003e {\n          result.hits.forEach((hit) =\u003e {\n            console.log(hit.uri, hit.source, hit.headline)\n          })\n          return loop()\n        })\n    }\n    loop()\n  })\n  .catch((err) =\u003e {\n    console.error(err)\n  })\n```\n\n### The ContentStream class\n\nWhile you can handle stream loops yourself, the API client supplies a utility\nclass to make content streaming easier.\n\n#### Methods\n\n- `constructor(api, mediaType, parameters)` -\n  - `api` - an `Api` instance\n  - `mediaType` and `parameters` - the same arguments accepted by\n    [api.content.stream()](#streammediatype-parameters)\n- `stop()` - request that the content stream be stopped. When the stream has\n  closed down and no more `data` events can be expected a final `close` event\n  will be emitted.\n\n#### Events\n\n- `data` - emitted once for every hit.\n- `error` - emitted on error. It is up to the user to decide how to handle this\n  error and if/when to close the content stream.\n- `close` - emitted when the content stream is closed. No more `data` events\n  will be emitted.\n\n#### Error handling\n\nOn errors which the client is unlikely to recover from by itself (i.e. HTTP\n4XX), the stream will automatically emit a `close` event and stop.\n\nWhen encountering other errors (HTTP 5xx, connections errors, etc.) the stream\nuses an exponential backoff algorithm to determine an appropriate delay before\nretrying the request. The initial delay is 50ms and doubles after each\nconsecutive error, up to 30s. The delay is reset to zero when a request\ncompletes successfully.\n\n#### Example\n\nThe following code is equivalent to the loop in the previous section. It prints\nthe `uri`, `source` and `headline` for each new image as it is added to the\ndatabase. It handles errors by printing a stack trace and closing down the\nstream.\n\n```typescript\nimport { Api, ContentStream } from '@ttab/api-client'\n\nlet api = new Api({ token: process.env.TOKEN || '' })\nlet stream = new ContentStream(api, 'image', {})\n\nstream.on('data', (hit) =\u003e {\n  console.info(hit.uri, hit.source, hit.headline)\n})\n\nstream.on('error', (err) =\u003e {\n  console.error('err', err)\n})\n\nstream.on('close', () =\u003e {\n  console.info('closed')\n})\n```\n\n## Errors\n\nErrors reported by the API or caused by the HTTP connection have the type\n`ApiError`.\n\n# API Reference\n\n## ContentV1\n\n### search(mediaType, parameters)\n\nSearching the TT archives.\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\" | \"stockfoto\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `tr?: \"h\" | \"d\" | \"w\" | \"m\" | \"y\"` - Time range: last hour, day, week,\n    month, or year.\n  - `trs?: string` - Start date\n  - `tre?: string` - End date\n  - `pubstatus?: Array\u003c\"usable\" | \"replaced\" | \"commissioned\"\u003e` - Searching for\n    `commissioned` items requires admin privileges.\n  - `s?: number` - Size of search result.\n  - `fr?: number` - Index into the search result. Used for pagination. It is\n    recommended to make this value a multiple of the search result size (`s`),\n    as some media types do not support arbitrary values here.\n  - `sort?: \"default:desc\" | \"default:asc\" | \"date:desc\" | \"date:asc\" | \"versioncreated:desc\" | \"versioncreated:asc\" | \"versionstored:desc\" | \"versionstored:asc\" | \"relevance\"` -\n    Sort order for the result. Documentation on various date fields can be found\n    [here](http://spec.tt.se/dates).\n    - default:desc / default:asc - Sort on the internal field '\\_tstamp' in\n      descending or ascending order respectively.\n    - date:desc / date:asc - Sort on the field 'date' in descending or ascending\n      order respectively.\n    - versioncreated:desc / versioncreated:asc - Sort on the field\n      'versioncreated' in descending or ascending order respectively.\n    - versionstored:desc / versionstored:asc - Sort on the field 'versionstored'\n      in descending or ascending order respectively.\n    - relevance - Sort on relevance. The most relevant matches first.\n  - `facets?: Array\u003c\"copyrightholder\" | \"person.name\" | \"place.name\" | \"product.code\" | \"subject.code\"\u003e` -\n    Enable search facets; in addition to the regular search result the API will\n    also return one or more additional facets which contain information about\n    how many search results can be expected if the current query is narrowed\n    down using popular subject codes, product codes, etc.\n  - `layout?: \"bare\" | \"full\"` - By default the full TTNinjs document is\n    returned for each search hit. This may be too cumbersome for some use cases;\n    for example when the client requests a large search result to be displayed\n    in a list form. This parameter allows the client to control the layout of\n    the items in the search result:\n    - full - (default) return the full TTNinjs document\n    - bare - return only `headline`, `date`, `uri`, `renditions`,\n      `associations`, `pubstatus`, `originaltransmissionreference`,\n      `copyrightholder`. In addition, all `associations` except the first are\n      stripped away, and `renditions` will only contain the thumbnail rendition.\n\n#### Returns\n\n- Promise\u0026lt;{ 'hits': Array\u003c[ttninjs](#interface-ttninjs)\u003e; 'total': number;\n  'facets'?: { 'subject.code'?: Array\u003c[facet](#interface-facet)\u003e;\n  'product.code'?: Array\u003c[facet](#interface-facet)\u003e; 'place.name'?:\n  Array\u003c[facet](#interface-facet)\u003e; 'person.name'?:\n  Array\u003c[facet](#interface-facet)\u003e; 'copyrightholder'?:\n  Array\u003c[facet](#interface-facet)\u003e;};}\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .search('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    tr: 'w',\n    sort: 'date:asc',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### stream(mediaType, parameters)\n\nRealtime delivery of content.\n\nLong poll call that will wait for a specified time period (default: 60s, max\n300s) until a matching item is published. The parameters are similar to those\nfor `search`, with the exception that time ranges and pagination doesn't make\nsense in this context (we will always return the most recent item).\n_DEPRECATED:_ This endpoint cannot guarantee delivery in the event that two\nitems are published at the exact same time. Consider using\n`/content/v1/{mediaType}/notification/stream` instead.\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `sort?: \"default:desc\" | \"default:asc\" | \"date:desc\" | \"date:asc\" | \"versioncreated:desc\" | \"versioncreated:asc\" | \"versionstored:desc\" | \"versionstored:asc\" | \"relevance\"` -\n    Sort order for the result. Documentation on various date fields can be found\n    [here](http://spec.tt.se/dates).\n    - default:desc / default:asc - Sort on the internal field '\\_tstamp' in\n      descending or ascending order respectively.\n    - date:desc / date:asc - Sort on the field 'date' in descending or ascending\n      order respectively.\n    - versioncreated:desc / versioncreated:asc - Sort on the field\n      'versioncreated' in descending or ascending order respectively.\n    - versionstored:desc / versionstored:asc - Sort on the field 'versionstored'\n      in descending or ascending order respectively.\n    - relevance - Sort on relevance. The most relevant matches first.\n  - `layout?: \"bare\" | \"full\"` - By default the full TTNinjs document is\n    returned for each search hit. This may be too cumbersome for some use cases;\n    for example when the client requests a large search result to be displayed\n    in a list form. This parameter allows the client to control the layout of\n    the items in the search result:\n    - full - (default) return the full TTNinjs document\n    - bare - return only `headline`, `date`, `uri`, `renditions`,\n      `associations`, `pubstatus`, `originaltransmissionreference`,\n      `copyrightholder`. In addition, all `associations` except the first are\n      stripped away, and `renditions` will only contain the thumbnail rendition.\n  - `last?: string` - The uri of the last item received.\n  - `wait?: number` - The time (in seconds) to wait for updates before returning\n    an empty result.\n\n#### Returns\n\n- Promise\u0026lt;{ 'hits': Array\u003c[ttninjs](#interface-ttninjs)\u003e;}\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .stream('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    sort: 'date:asc',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### getNotifications(mediaType)\n\nList all notifications\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n\n#### Returns\n\n- Promise\u0026lt;Array\u003c[notification](#interface-notification)\u003e\u0026gt;\n\n#### Example\n\n```typescript\napi.content.getNotifications('image').then((result) =\u003e {\n  // do something with result\n})\n```\n\n### addNotificationMobile(mediaType, parameters)\n\nCreate a new mobile notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `title: string` -\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .addNotificationMobile('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    title: 'my mobile notification',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### addNotificationEmail(mediaType, parameters)\n\nCreate a new email notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `title: string` -\n  - `email: string` - The email address to send emails to.\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .addNotificationEmail('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    title: 'my email notification',\n    email: 'my.email@address.com',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### addNotificationScheduledEmail(mediaType, parameters)\n\nCreate a new scheduled email notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `tr?: \"h\" | \"d\" | \"w\" | \"m\" | \"y\"` - Time range: last hour, day, week,\n    month, or year.\n  - `title: string` -\n  - `email: string` - The email address to send emails to.\n  - `schedule: string` - A cron expression.\n  - `timezone?: string` - A valid time zone name\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .addNotificationScheduledEmail('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    tr: 'w',\n    title: 'my scheduled email notification',\n    email: 'my.email@address.com',\n    schedule: '0 0 12 * * MON-FRI',\n    timezone: 'Europe/Stockholm',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### addNotificationStream(mediaType, parameters)\n\nCreate a new content stream\n\nCreates a new notification of type `stream` and returns the details. Items of\nthe given `mediaType` matching the parameters `q`, `p` and `agr` will be added\nto the stream in near real-time as they are indexed into the content database.\nThe contents of the stream can be consumed by calling the\n`GET /content/v1/{mediaType}/notification/{id}/stream` endpoint.\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `title?: string` -\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .addNotificationStream('image', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    title: 'my stream notification',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### updateNotificationMobile(mediaType, id, parameters)\n\nUpdate an existing mobile notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `title: string` -\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .updateNotificationMobile('image', '4a37869c-808f-496f-b549-3da0821ce187', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    title: 'my mobile notification',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### updateNotificationEmail(mediaType, id, parameters)\n\nUpdate an existing email notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `title: string` -\n  - `email: string` - The email address to send emails to.\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .updateNotificationEmail('image', '4a37869c-808f-496f-b549-3da0821ce187', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    title: 'my email notification',\n    email: 'my.email@address.com',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### updateNotificationScheduledEmail(mediaType, id, parameters)\n\nUpdate an existing scheduled email notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `tr?: \"h\" | \"d\" | \"w\" | \"m\" | \"y\"` - Time range: last hour, day, week,\n    month, or year.\n  - `title: string` -\n  - `email: string` - The email address to send emails to.\n  - `schedule: string` - A cron expression.\n  - `timezone?: string` - A valid time zone name\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .updateNotificationScheduledEmail(\n    'image',\n    '4a37869c-808f-496f-b549-3da0821ce187',\n    {\n      q: 'panda',\n      p: ['FOGNRE', '-FOGNREEJ'],\n      agr: [20031, 20035],\n      tr: 'w',\n      title: 'my scheduled email notification',\n      email: 'my.email@address.com',\n      schedule: '0 0 12 * * MON-FRI',\n      timezone: 'Europe/Stockholm',\n    }\n  )\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### updateNotificationStream(mediaType, id, parameters)\n\nUpdate an existing content stream\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n- parameters:\n  - `q?: string` - A query string used for free text searching.\n  - `p?: Array\u003cstring\u003e` - A list of product codes. Only items matching at least\n    one of these codes will be returned. The list of current product codes is\n    [here](https://tt.se/spec/product/1.0). Individual product codes may be\n    prefixed with a '-' sign, indicating that the code should instead be\n    excluded from the search result.\n  - `agr?: Array\u003cnumber\u003e` - A list of customer agreement IDs belonging to the\n    current user. Only items covered by at least one of there agreements will be\n    returned.\n  - `tr?: \"h\" | \"d\" | \"w\" | \"m\" | \"y\"` - Time range: last hour, day, week,\n    month, or year.\n  - `title: string` -\n\n#### Returns\n\n- Promise\u0026lt;[notification](#interface-notification)\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .updateNotificationStream('image', '4a37869c-808f-496f-b549-3da0821ce187', {\n    q: 'panda',\n    p: ['FOGNRE', '-FOGNREEJ'],\n    agr: [20031, 20035],\n    tr: 'w',\n    title: 'my stream notification',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### getNotificationStream(mediaType, id, parameters)\n\nRead new items from a content stream\n\nThis is a HTTP long-poll request that consumes items from a previously created\nnotification stream. It will hang until content is available, or a\npre-determined number of seconds (given by the `wait` parameter) has passed,\nwhichever comes first. In the latter case, the response code will still be HTTP\n200, but the `hits` property of the result body will be an empty array. Note\nthat this endpoint is not idempotent; calling it repeatedly will yield different\nresults depending on the current contents of the stream. Notification streams\nexpire after 5 minutes of client inactivity.\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n- parameters:\n  - `s?: number` - Size of search result.\n  - `layout?: \"bare\" | \"full\"` - By default the full TTNinjs document is\n    returned for each search hit. This may be too cumbersome for some use cases;\n    for example when the client requests a large search result to be displayed\n    in a list form. This parameter allows the client to control the layout of\n    the items in the search result:\n    - full - (default) return the full TTNinjs document\n    - bare - return only `headline`, `date`, `uri`, `renditions`,\n      `associations`, `pubstatus`, `originaltransmissionreference`,\n      `copyrightholder`. In addition, all `associations` except the first are\n      stripped away, and `renditions` will only contain the thumbnail rendition.\n  - `wait?: number` - The time (in seconds) to wait for updates before returning\n    an empty result.\n\n#### Returns\n\n- Promise\u0026lt;{ 'hits': Array\u003c[ttninjs](#interface-ttninjs)\u003e;}\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .getNotificationStream('image', '4a37869c-808f-496f-b549-3da0821ce187', {})\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### removeNotification(mediaType, id)\n\nRemove an existing notification\n\n#### Arguments\n\n- mediaType:\n  `\"_all\" | \"image\" | \"video\" | \"graphic\" | \"text\" | \"feature\" | \"page\" | \"planning\" | \"calendar\"` -\n  Only return items of this media type.\n- id: `string` - An notification UUID string.\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.content\n  .removeNotification('image', '4a37869c-808f-496f-b549-3da0821ce187')\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n## UserV1\n\n### getAgreements()\n\nGet the current customer agreements.\n\nReturn a list of applicable customer agreements for the current user. An\nagreement that has a truthy value of isSuperAgreement will override any\nagreement of Subscription type.\n\n_DEPRECATED_: This endpoint has been deprecated in favor of `/user/v1/user`\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;Array\u003c[agreement](#interface-agreement)\u003e\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getAgreements().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getOrder(parameters)\n\nGet the order/license history for the current user. If the user has customer\nadmin privileges, include all orders for the whole organization.\n\n#### Arguments\n\n- parameters:\n  - `size?: number` -\n  - `start?: number` -\n  - `status?: \"reported\" | \"unreported\" | \"all\"` -\n\n#### Returns\n\n- Promise\u0026lt;{ 'orders'?: Array\u003c[order](#interface-order)\u003e;}\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getOrder({}).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### updateOrder(id, order)\n\nUpdate an unreported order row.\n\n#### Arguments\n\n- id: `number` -\n- order?:\n  `{ 'license'?: { 'uuid': string;}; 'invoiceText'?: string; 'approve': boolean;}`\n\n#### Returns\n\n- Promise\u0026lt;[order](#interface-order)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.updateOrder().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getProfile()\n\nGet the profile for the current user.\n\nThe user profile is an unstructured JSON object containing non-secret\napplication data (settings and such). Web applications are free to access this\ninformation as they see fit.\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;{ }\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getProfile().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### updateProfile(profile)\n\nUpdate the profile for the current user.\n\nReplaces the entire user profile with the object passed in the request body.\n\nFor more controlled updates of the user profile, use the\n`PUT /user/v1/profile/{property}` endpoint.\n\n#### Arguments\n\n- profile?: `{ }`\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.user.updateProfile({ property1: 'customValue' }).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getProfileByProperty(property)\n\nGet selected properties of the profile for the current user.\n\nThe user profile is an unstructured JSON object containing non-secret\napplication data (settings and such). Web applications are free to access this\ninformation as they see fit. Often, applications are not interested in the whole\nuser profile. This endpoint returns only selected properties.\n\n#### Arguments\n\n- property: `Array\u003cstring\u003e` - A list of property names.\n\n#### Returns\n\n- Promise\u0026lt;{ }\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getProfileByProperty(['property1', 'property2']).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### updateProfileByProperty(property, profile)\n\nUpdate selected properties of the profile for the current user.\n\nReplaces selected properties, but doesn't modify the rest of the user profile.\nThis is a more controlled version of the `PUT /user/v1/profile` endpoint.\n\nGiven a `profile` object like\n\n    {\n        \"property1\": { ... },\n        \"property2\": { ... },\n        ...\n    }\n\nand a `property` parameter like `property1,property2`, this endpoint will update\nthe given properties, but leave the rest of the user profile intact. Properties\npresent in `profile` but not listed in `property` will not be written.\nConversely, properties listed in `property` but not present in `profile` will\nnot be overwritten with `null`.\n\n#### Arguments\n\n- property: `Array\u003cstring\u003e` - A list of property names.\n- profile?: `{ }`\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.user\n  .updateProfileByProperty(['property1', 'property2'], {\n    property1: 'customValue',\n  })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### updateDevice(token, parameters)\n\nRegister a new mobile device.\n\n#### Arguments\n\n- token: `string` -\n- parameters:\n  - `type: \"ios\" | \"ios-sandbox\" | \"android\"` - The type of device:\n    - `ios` (for the production environment)\n    - `ios-sandbox` (for the APN sandbox)\n    - `android`\n  - `name?: string` - The name of this mobile device.\n  - `model: string` - The model of this mobile device.\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.user\n  .updateDevice(\n    '5a21a38a24857b344c66aadade0abf2a748fcacf2ddf466e83e4fcd1cefab66a',\n    { type: 'ios', name: 'my iPhone', model: 'iPhone 8' }\n  )\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### removeDevice(token)\n\nUnregister a mobile device.\n\n#### Arguments\n\n- token: `string` -\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.user\n  .removeDevice(\n    '5a21a38a24857b344c66aadade0abf2a748fcacf2ddf466e83e4fcd1cefab66a'\n  )\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### getOrganization()\n\nGet information about the organization that the current user belongs to.\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;[organization](#interface-organization)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getOrganization().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getOrganizationUsers()\n\nList the users belonging to the same organization as the current user. Requires\nthe user to have the `admin` access level, and the token to have the `admin`\nscope.\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;Array\u003c[userBase](#interface-userBase)\u003e\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getOrganizationUsers().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### addOrganizationUser(user)\n\nCreate a new user for the same organization as the current user. Requires the\nuser to have the `admin` access level, and the token to have the `admin` scope.\n\n#### Arguments\n\n- user?:\n  `{ 'firstName': string; 'lastName': string; 'emailAddress': string; 'phoneNumber'?: phoneNumber; 'department'?: string; 'access'?: access;}`\n\n#### Returns\n\n- Promise\u0026lt;[user](#interface-user)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.addOrganizationUser().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getOrganizationUser(id)\n\nGet information about a user belonging to the same organization as the current\nuser. Requires the user to have the `admin` access level, and the token to have\nthe `admin` scope.\n\n#### Arguments\n\n- id: `number` - A user ID\n\n#### Returns\n\n- Promise\u0026lt;[user](#interface-user)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getOrganizationUser(123).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### updateOrganizationUser(id, user)\n\nUpdate a user belonging to the same organization as the current user. Requires\nthe user to have the `admin` access level, and the token to have the `admin`\nscope.\n\n#### Arguments\n\n- id: `number` - A user ID\n- user?:\n  `{ 'firstName'?: string; 'lastName'?: string; 'emailAddress'?: string; 'phoneNumber'?: phoneNumber; 'department'?: string; 'access'?: access;}`\n\n#### Returns\n\n- Promise\u0026lt;[user](#interface-user)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.updateOrganizationUser(123).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getUser()\n\nGet information about the current user.\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;[user](#interface-user)\u0026gt;\n\n#### Example\n\n```typescript\napi.user.getUser().then((result) =\u003e {\n  // do something with result\n})\n```\n\n## CollectionV1\n\n### getCollections()\n\nList all collections\n\nReturns a list of all collections belonging to the current user.\n\n#### Arguments\n\n#### Returns\n\n- Promise\u0026lt;Array\u003c[collection](#interface-collection)\u003e\u0026gt;\n\n#### Example\n\n```typescript\napi.collection.getCollections().then((result) =\u003e {\n  // do something with result\n})\n```\n\n### addCollection(collection)\n\nCreate a new collection.\n\nCreates an new named collection for the current user. This operation is\nasynchronous, and there may be a delay before the change is visible using the\n`GET /collection/v1/collection` endpoint.\n\n#### Arguments\n\n- collection: `{ 'name': string; 'public'?: boolean;}`\n\n#### Returns\n\n- Promise\u0026lt;[collection](#interface-collection)\u0026gt;\n\n#### Example\n\n```typescript\napi.collection.addCollection({ name: 'my collection' }).then((result) =\u003e {\n  // do something with result\n})\n```\n\n### getCollection(id)\n\nGet collection properties and contents\n\nReturns all properties and contents of a single collection.\n\n#### Arguments\n\n- id: `string` - ID of a collection.\n\n#### Returns\n\n- Promise\u0026lt;[collectionItem](#interface-collectionItem)\u0026gt;\n\n#### Example\n\n```typescript\napi.collection.getCollection('123').then((result) =\u003e {\n  // do something with result\n})\n```\n\n### updateCollection(id, collection)\n\nUpdate collection properties\n\nUpdates an existing collection belonging to the current user. This operation is\nasynchronous, and there may be a delay before the change is visible using the\n`GET /collection/v1/collection` endpoint.\n\n#### Arguments\n\n- id: `string` - ID of a collection.\n- collection: `{ 'name': string; 'public'?: boolean;}`\n\n#### Returns\n\n- Promise\u0026lt;[collection](#interface-collection)\u0026gt;\n\n#### Example\n\n```typescript\napi.collection\n  .updateCollection('123', { name: 'my collection' })\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### removeCollection(id)\n\nRemove an existing collection\n\nRemoves an existing collection belonging to the current user. This operation is\nasynchronous, and there may be a delay before the change is visible using the\n`GET /collection/v1/collection` endpoint.\n\n#### Arguments\n\n- id: `string` - ID of a collection.\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.collection.removeCollection('123').then((result) =\u003e {\n  // do something with result\n})\n```\n\n### addCollectionItems(id, items)\n\nAdd items to collection\n\nAdds any number of items to a given collection belonging to the current user.\nThe items must exist in the content database and be visible for the user. If\nnot, this call will still return successfully, but the collection remain\nunchanged. This operation is asynchronous, and there may be a delay before\nchanges are visible using the `GET /collection/v1/collection/{id}` endpoint.\n\n#### Arguments\n\n- id: `string` - ID of a collection.\n- items: `Array\u003c{ 'uri': string;}\u003e`\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.collection\n  .addCollectionItems('123', [{ uri: 'http://tt.se/media/image/sdltd8f4d87' }])\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n### removeCollectionItems(id, items)\n\nRemove items from collection\n\nRemoves any number of items from a given collection belonging to the current\nuser. If one or more items do not currently belong to the collection, this call\nwill still return successfully, but those items will be ignored. This operation\nis asynchronous, and there may be a delay before changes are visible using the\n`GET /collection/v1/collection/{id}` endpoint.\n\n#### Arguments\n\n- id: `string` - ID of a collection.\n- items: `Array\u003c{ 'uri': string;}\u003e`\n\n#### Returns\n\n- Promise\u0026lt;string\u0026gt;\n\n#### Example\n\n```typescript\napi.collection\n  .removeCollectionItems('123', [\n    { uri: 'http://tt.se/media/image/sdltd8f4d87' },\n  ])\n  .then((result) =\u003e {\n    // do something with result\n  })\n```\n\n## Exported types\n\n### Interface ttninjs\n\n```typescript\ninterface ttninjs {\n  uri: string\n  type?:\n    | 'text'\n    | 'audio'\n    | 'video'\n    | 'picture'\n    | 'graphic'\n    | 'composite'\n    | 'planning'\n    | 'component'\n    | 'event'\n  mimetype?: string\n  representationtype?: 'complete' | 'incomplete' | 'associated'\n  profile?: 'PUBL' | 'DATA' | 'INFO' | 'RAW'\n  version?: string\n  firstcreated?: string\n  versioncreated?: string\n  contentcreated?: string\n  versionstored?: string\n  embargoed?: string\n  embargoedreason?: string\n  date?: string\n  datetime?: string\n  enddate?: string\n  enddatetime?: string\n  job?: string\n  pubstatus?: 'usable' | 'withheld' | 'canceled' | 'replaced' | 'commissioned'\n  urgency?: number\n  copyrightholder?: string\n  copyrightnotice?: string\n  usageterms?: string\n  ednote?: string\n  language?: string\n  week?: number\n  webprio?: number\n  newsvalue?: 1 | 2 | 3 | 4 | 5 | 6\n  source?: string\n  commissioncode?: string\n  description_text?: string\n  description_usage?: string\n  body_text?: string\n  body_html5?: string\n  body_richhtml5?: string\n  body_event?: {\n    arena?: string\n    city?: string\n    address?: string\n    country?: string\n    eventurl?: string\n    eventphone?: string\n    eventweb?: string\n    organizer?: string\n    organizeraddress?: string\n    organizercity?: string\n    organizercountry?: string\n    organizerurl?: string\n    organizerphone?: string\n    organizermail?: string\n    eventstatus?: string\n    eventstatus_text?: string\n    region?: string\n    region_text?: string\n    municipality?: string\n    municipality_text?: string\n    eventtags?: string\n    eventtype?: string\n    eventtype_text?: string\n    note_extra?: string\n    note_pm?: string\n    accreditation?: string\n    extraurl?: string\n    createddate?: string\n    createdby?: string\n    changeddate?: string\n    changedby?: string\n    courtcasenumber?: string\n  }\n  body_sportsml?: string\n  body_pages?: {}\n  commissionedby?: Array\u003cstring\u003e\n  person?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n    contactinfo?: Array\u003ccontactinfoType\u003e\n  }\u003e\n  organisation?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n    symbols?: Array\u003c{\n      ticker?: string\n      exchange?: string\n      symboltype?: string\n      symbol?: string\n    }\u003e\n    contactinfo?: Array\u003ccontactinfoType\u003e\n  }\u003e\n  place?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n    geometry_geojson?: {\n      type?: 'Point'\n      coordinates?: Array\u003cnumber\u003e\n    }\n    contactinfo?: Array\u003ccontactinfoType\u003e\n  }\u003e\n  subject?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n    creator?: string\n    relevance?: number\n    confidence?: number\n  }\u003e\n  event?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n  }\u003e\n  object?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n  }\u003e\n  infosource?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n    contactinfo?: Array\u003ccontactinfoType\u003e\n  }\u003e\n  title?: string\n  byline?: string\n  bylines?: Array\u003c{\n    byline?: string\n    firstname?: string\n    lastname?: string\n    role?: string\n    email?: string\n    jobtitle?: string\n    internal?: string\n    phone?: string\n    initials?: string\n    affiliation?: string\n  }\u003e\n  headline?: string\n  slug?: string\n  slugline?: string\n  located?: string\n  charcount?: number\n  wordcount?: number\n  renditions?: {}\n  associations?: {}\n  altids?: {\n    originaltransmissionreference?: string\n  }\n  originaltransmissionreference?: string\n  trustindicator?: Array\u003c{\n    scheme?: string\n    code?: string\n    title?: string\n    href?: string\n  }\u003e\n  $standard?: {\n    name?: string\n    version?: string\n    schema?: string\n  }\n  genre?: Array\u003c{\n    name?: string\n    scheme?: string\n    code?: string\n  }\u003e\n  expires?: string\n  rightsinfo?: {\n    langid?: string\n    linkedrights?: string\n    encodedrights?: string\n  }\n  signals?: {\n    pageproduct?: string\n    multipagecount?: number\n    paginae?: Array\u003cstring\u003e\n    pagecode?: string\n    pagevariant?: string\n    updatetype?: 'KORR' | 'RÄ' | 'UV'\n    retransmission?: boolean\n  }\n  product?: Array\u003c{\n    name?: string\n    scheme?: string\n    code?: string\n  }\u003e\n  replacing?: Array\u003cstring\u003e\n  replacedby?: string\n  assignments?: {}\n  revisions?: Array\u003c{\n    uri: string\n    slug?: string\n    replacing?: Array\u003cstring\u003e\n    versioncreated?: string\n  }\u003e\n  sector?: 'INR' | 'UTR' | 'EKO' | 'KLT' | 'SPT' | 'FEA' | 'NOJ' | 'PRM'\n  fixture?: Array\u003c{\n    name?: string\n    rel?: string\n    scheme?: string\n    code?: string\n  }\u003e\n  advice?: Array\u003c{\n    role?: 'publish'\n    environment?: Array\u003c{\n      code?: string\n      scheme?: string\n    }\u003e\n    importance?: {\n      code?: string\n      scheme?: string\n    }\n    lifetime?: {\n      code?: string\n      scheme?: string\n    }\n  }\u003e\n}\n```\n\n### Interface access\n\n```typescript\ninterface access {\n  admin?: boolean\n  mediebank?: boolean\n}\n```\n\n### Interface address\n\n```typescript\ninterface address {\n  street?: string\n  box?: string\n  zipCode?: string\n  city?: string\n  country?: string\n}\n```\n\n### Interface agreement\n\n```typescript\ninterface agreement {\n  id?: number\n  description?: {}\n  type?: 'Subscription' | 'Direct' | 'Normal' | 'Sketch'\n  isSuperAgreement?: boolean\n  products?: Array\u003cproduct\u003e\n}\n```\n\n### Interface agreement2\n\n```typescript\ninterface agreement2 {\n  id: number\n  name?: string\n  type: agreementType\n  description?: string\n  expires?: string\n  superAgreement: boolean\n  products: Array\u003cproduct2\u003e\n  prepaids?: {\n    total: number\n    remaining: number\n  }\n}\n```\n\n### Interface agreementType\n\n```typescript\ninterface agreementType \"Subscription\" | \"Direct\" | \"Normal\" | \"Prepaid\";\n```\n\n### Interface collection\n\n```typescript\ninterface collection {\n  accessed: string\n  content: Array\u003cstring\u003e\n  removedContent?: Array\u003c{\n    uri?: string\n    headline?: string\n    description_text?: string\n    timestamp?: string\n  }\u003e\n  created: string\n  id: string\n  modified?: string\n  name: string\n  owner: string\n  public: boolean\n}\n```\n\n### Interface collectionItem\n\n```typescript\ninterface collectionItem {\n  accessed: string\n  content: Array\u003cstring\u003e\n  removedContent?: Array\u003c{\n    uri?: string\n    headline?: string\n    description_text?: string\n    timestamp?: string\n  }\u003e\n  created: string\n  id: string\n  modified?: string\n  name: string\n  owner: string\n  public: boolean\n  items: Array\u003cttninjs\u003e\n}\n```\n\n### Interface error\n\n```typescript\ninterface error {\n  errorCode?: string\n  location?: string\n  message?: string\n  path?: string\n}\n```\n\n### Interface errors\n\n```typescript\ninterface errors {\n  errors?: Array\u003cerror\u003e\n}\n```\n\n### Interface facet\n\n```typescript\ninterface facet {\n  key?: string\n  count?: number\n}\n```\n\n### Interface license\n\n```typescript\ninterface license {\n  uuid?: string\n  period?: 'Year' | 'Month' | 'Single'\n  volume?: string\n  price?: monetaryAmount\n  description?: string\n  product: product\n}\n```\n\n### Interface monetaryAmount\n\n```typescript\ninterface monetaryAmount string;\n```\n\n### Interface order\n\n```typescript\ninterface order {\n  id: number\n  item: {\n    uri?: string\n    headline?: string\n    byline?: string\n    source?: string\n  }\n  price: {\n    name: string\n    description?: string\n    license: license\n    agreement: {\n      id: number\n      name?: string\n      type: agreementType\n    }\n  }\n  invoiceText?: string\n  created: string\n  downloadableUntil: string\n  reportingDeadline?: string\n  reported?: string\n  approved?: boolean\n  manual?: boolean\n}\n```\n\n### Interface notification\n\n```typescript\ninterface notification {\n  id: string\n  title?: string\n  type: 'mobile' | 'email' | 'scheduled-email' | 'stream'\n  mediaType:\n    | '_all'\n    | 'image'\n    | 'video'\n    | 'graphic'\n    | 'text'\n    | 'feature'\n    | 'page'\n    | 'planning'\n    | 'calendar'\n  q?: string\n  p?: Array\u003cstring\u003e\n  agr?: Array\u003cnumber\u003e\n  schedule?: string\n  timezone?: string\n  email?: string\n}\n```\n\n### Interface organization\n\n```typescript\ninterface organization {\n  id: number\n  name?: string\n  currency?: string\n  country?: string\n  address: {\n    visit?: address\n    postal?: address\n    billing?: address\n  }\n  phoneNumber: phoneNumberDirect\n}\n```\n\n### Interface phoneNumber\n\n```typescript\ninterface phoneNumber {\n  direct?: string\n  mobile?: string\n}\n```\n\n### Interface phoneNumberDirect\n\n```typescript\ninterface phoneNumberDirect {\n  direct?: string\n}\n```\n\n### Interface product\n\n```typescript\ninterface product {\n  name?: string\n  description?: {}\n  code?: string\n}\n```\n\n### Interface product2\n\n```typescript\ninterface product2 {\n  id: number\n  name?: string\n  description?: string\n  code: string\n}\n```\n\n### Interface user\n\n```typescript\ninterface user {\n  id: number\n  customerId?: number\n  userName: string\n  firstName?: string\n  lastName?: string\n  emailAddress?: string\n  department?: string\n  phoneNumber: phoneNumber\n  agreements: Array\u003cagreement2\u003e\n  access: access\n  active: boolean\n}\n```\n\n### Interface userBase\n\n```typescript\ninterface userBase {\n  id: number\n  customerId?: number\n  userName: string\n  firstName?: string\n  lastName?: string\n  emailAddress?: string\n  department?: string\n  active: boolean\n}\n```\n\n### Interface contactinfoType\n\n```typescript\ninterface contactinfoType {\n  type?: string\n  role?: string\n  lang?: string\n  name?: string\n  value?: string\n  address?: {\n    lines?: Array\u003cstring\u003e\n    locality?: string\n    area?: string\n    postalcode?: string\n    country?: string\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Ftypescript-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttab%2Ftypescript-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Ftypescript-api-client/lists"}