From b505bc9786445c0fc98b4fce22b94786d98e9ef8 Mon Sep 17 00:00:00 2001 From: Brian Gonzalez Date: Fri, 10 Jun 2022 11:49:22 -0600 Subject: [PATCH 1/5] feat: adds settings on Tenant and deduplicate_token on Token --- source/includes/api-reference/_tenants.md | 49 +++++++++++++++++------ source/includes/api-reference/_tokens.md | 11 +++-- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/source/includes/api-reference/_tenants.md b/source/includes/api-reference/_tenants.md index 69b8c082..e3960e38 100644 --- a/source/includes/api-reference/_tenants.md +++ b/source/includes/api-reference/_tenants.md @@ -5,15 +5,16 @@ Tenants provide a way to logically group your Applications and tokens. Common us ## Tenant Object -| Attribute | Type | Description | -|---------------|----------|---------------------------------------------------------------------------------------------| -| `id` | *uuid* | Unique identifier of the Tenants | -| `owner_id` | *uuid* | The user ID which owns the Tenants | -| `name` | *string* | The name of the Tenants | -| `created_by` | *uuid* | (Optional) The ID of the user that created the Tenant | -| `created_at` | *date* | (Optional) Created date of the Tenant in ISO 8601 format | -| `modified_by` | *uuid* | (Optional) The ID of the user or [Application](#applications) that last modified the Tenant | -| `modified_at` | *date* | (Optional) Last modified date of the Tenant in ISO 8601 format | +| Attribute | Type | Description | +|---------------|----------------------------------------------------|---------------------------------------------------------------------------------------------| +| `id` | *uuid* | Unique identifier of the Tenant | +| `owner_id` | *uuid* | The user ID which owns the Tenant | +| `name` | *string* | The name of the Tenant | +| `settings` | [Tenant Settings](#tenants-tenant-settings-object) | The setting for the Tenant | +| `created_by` | *uuid* | (Optional) The ID of the user that created the Tenant | +| `created_at` | *date* | (Optional) Created date of the Tenant in ISO 8601 format | +| `modified_by` | *uuid* | (Optional) The ID of the user or [Application](#applications) that last modified the Tenant | +| `modified_at` | *date* | (Optional) Last modified date of the Tenant in ISO 8601 format | ## Tenant Usage Report Object @@ -40,6 +41,12 @@ Tenants provide a way to logically group your Applications and tokens. Common us | `count` | *long* | Number of tokens | | `last_created_at` | *date* | (Optional) Last created date in ISO 8601 format | +## Tenant Settings Object + +| Attribute | Type | Description | +|----------------------|------------|----------------------------------------------------------------| +| `deduplicate_tokens` | *string* | (Bool) Whether tokens are deduplicated on creation and updates | + ## Get a Tenant > Request @@ -82,6 +89,9 @@ with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_ "id": "f88da999-b124-4a14-acde-cbc121444f14", "owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21", "name": "My Tenant", + "settings": { + "deduplicate_tokens": "false" + }, "created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a", "created_at": "2020-09-15T15:53:00+00:00", "modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a", @@ -117,7 +127,10 @@ curl "https://api.basistheory.com/tenants/self" \ -H "Content-Type: application/json" \ -X "PUT" \ -d '{ - "name": "My Example Tenant" + "name": "My Example Tenant", + "settings": { + "deduplicate_tokens": "true" + } }' ``` @@ -128,6 +141,9 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED'); const tenant = await bt.tenants.update({ name: 'My Example Tenant', + settings: { + "deduplicate_tokens": "true" + } }); ``` @@ -138,6 +154,9 @@ var client = new TenantClient("key_N88mVGsp3sCXkykyN2EFED"); var tenant = await client.UpdateAsync(new Tenant { Name = "My Example Tenant" + Settings = new Dictionary { + { "deduplicate_tokens", "true" } + }, }); ``` @@ -161,6 +180,9 @@ with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_ "id": "f88da999-b124-4a14-acde-cbc121444f14", "owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21", "name": "My Example Tenant", + "settings": { + "deduplicate_tokens": "true" + }, "created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a", "created_at": "2020-09-15T15:53:00+00:00", "modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a", @@ -183,9 +205,10 @@ Update the Tenant associated with the provided `BT-API-KEY`. ### Request Parameters -| Attribute | Required | Type | Default | Description | -|-----------|----------|----------|---------|-------------------------------------------------------| -| `name` | true | *string* | `null` | The name of the Tenant. Has a maximum length of `200` | +| Attribute | Required | Type | Default | Description | +|------------|----------|----------|----------------------------------------------------|-------------------------------------------------------| +| `name` | true | *string* | `null` | The name of the Tenant. Has a maximum length of `200` | +| `settings` | false | *string* | [Tenant Settings](#tenants-tenant-settings-object) | The settings for the Tenant | ### Response diff --git a/source/includes/api-reference/_tokens.md b/source/includes/api-reference/_tokens.md index 37eebf85..1d8237b8 100644 --- a/source/includes/api-reference/_tokens.md +++ b/source/includes/api-reference/_tokens.md @@ -17,6 +17,7 @@ | `modified_at` | *date* | (Optional) Last modified date of the token in ISO 8601 format | | `search_indexes` | *array* | (Optional) Array of search index [expressions](/expressions/#search-indexes) used when creating the token. | | `fingerprint_expression` | *string* | (Optional) An [expression](/expressions/#fingerprints) defining the value to fingerprint when creating the token. | +| `deduplicate_token` | *bool* | (Optional) A boolean defining whether tokens are deduplicated when creating the token. | ### Privacy Object @@ -133,7 +134,8 @@ curl "https://api.basistheory.com/tokens" \ "{{ data }}", "{{ data | last4}}" ], - "fingerprint_expression": "{{ data }}" + "fingerprint_expression": "{{ data }}", + "deduplicate_token": true, }' ``` @@ -155,7 +157,8 @@ const token = await bt.tokens.create({ '{{ data }}', '{{ data | last4}}' ], - fingerprintExpression: "{{ data }}" + fingerprintExpression: "{{ data }}", + deduplicateToken: true, }); ``` @@ -177,7 +180,8 @@ var token = await client.CreateAsync(new Token { "{{ data }}", "{{ data | last4}}" } - FingerprintExpression = "{{ data }}" + FingerprintExpression = "{{ data }}", + DeduplicateToken = true, }); ``` @@ -226,6 +230,7 @@ with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_ "{{ data | last4}}" ], "fingerprint_expression": "{{ data }}", + "deduplicate_token": true, "created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a", "created_at": "2020-09-15T15:53:00+00:00" } From 7092bbc0d8b2f9f5b53bfc984be37e6d95da5d03 Mon Sep 17 00:00:00 2001 From: Brian Gonzalez Date: Fri, 10 Jun 2022 11:57:34 -0600 Subject: [PATCH 2/5] chore: adds missing request params for creating a token --- source/includes/api-reference/_tokens.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/includes/api-reference/_tokens.md b/source/includes/api-reference/_tokens.md index 1d8237b8..62311fea 100644 --- a/source/includes/api-reference/_tokens.md +++ b/source/includes/api-reference/_tokens.md @@ -251,13 +251,15 @@ Create a new token for the Tenant. ### Request Parameters -| Attribute | Required | Type | Default | Description | -|------------------|----------|---------------------------------------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | true | *string* | `null` | [Token type](#token-types) of the token | -| `data` | true | *any* | `null` | Token data. Can be an object, array, or any primitive type such as an integer, boolean, or string | -| `privacy` | false | *[privacy object](#tokens-token-object-privacy-object)* | `null` | Token Privacy Settings overrides. Overrides must be a higher specificity level than the default or minimum setting for the [Token Type](#token-token-types). | -| `metadata` | false | *map* | `null` | A key-value map of non-sensitive data. | -| `search_indexes` | false | *array* | `null` | Array of [expressions](#expressions) used to generate indexes to be able to search against. | +| Attribute | Required | Type | Default | Description | +|--------------------------|----------|---------------------------------------------------------|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | true | *string* | `null` | [Token type](#token-types) of the token | +| `data` | true | *any* | `null` | Token data. Can be an object, array, or any primitive type such as an integer, boolean, or string | +| `privacy` | false | *[privacy object](#tokens-token-object-privacy-object)* | `null` | Token Privacy Settings overrides. Overrides must be a higher specificity level than the default or minimum setting for the [Token Type](#token-token-types). | +| `metadata` | false | *map* | `null` | A key-value map of non-sensitive data. | +| `search_indexes` | false | *array* | `null` | Array of [expressions](#expressions) used to generate indexes to be able to search against. | +| `fingerprint_expression` | false | *string* | {{ data | stringify }} | [Expressions](#expressions) used to fingerprint your token. | +| `deduplicate_token` | false | *bool* | `null` | Whether the token is deduplicated on creation. |