From 44b721b6ae37fcaf4199d771ffdfb18fd57a113a Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 8 Sep 2023 10:35:49 -0700 Subject: [PATCH] Add personal-details user preference with birth date (#1565) * Add personal-details user preference with birth date * Add personal details pref to settings union --- lexicons/app/bsky/actor/defs.json | 17 ++++++++++++++++- packages/api/src/client/lexicons.ts | 11 +++++++++++ .../src/client/types/app/bsky/actor/defs.ts | 19 +++++++++++++++++++ packages/bsky/src/lexicon/lexicons.ts | 11 +++++++++++ .../src/lexicon/types/app/bsky/actor/defs.ts | 19 +++++++++++++++++++ packages/pds/src/lexicon/lexicons.ts | 11 +++++++++++ .../src/lexicon/types/app/bsky/actor/defs.ts | 19 +++++++++++++++++++ 7 files changed, 106 insertions(+), 1 deletion(-) diff --git a/lexicons/app/bsky/actor/defs.json b/lexicons/app/bsky/actor/defs.json index bd321aa60ed..6b6017d049d 100644 --- a/lexicons/app/bsky/actor/defs.json +++ b/lexicons/app/bsky/actor/defs.json @@ -94,7 +94,12 @@ "type": "array", "items": { "type": "union", - "refs": ["#adultContentPref", "#contentLabelPref", "#savedFeedsPref"] + "refs": [ + "#adultContentPref", + "#contentLabelPref", + "#savedFeedsPref", + "#personalDetailsPref" + ] } }, "adultContentPref": { @@ -134,6 +139,16 @@ } } } + }, + "personalDetailsPref": { + "type": "object", + "properties": { + "birthDate": { + "type": "string", + "format": "datetime", + "description": "The birth date of the owner of the account." + } + } } } } diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index e15d7aba1ce..193b9c39d37 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3714,6 +3714,7 @@ export const schemaDict = { 'lex:app.bsky.actor.defs#adultContentPref', 'lex:app.bsky.actor.defs#contentLabelPref', 'lex:app.bsky.actor.defs#savedFeedsPref', + 'lex:app.bsky.actor.defs#personalDetailsPref', ], }, }, @@ -3760,6 +3761,16 @@ export const schemaDict = { }, }, }, + personalDetailsPref: { + type: 'object', + properties: { + birthDate: { + type: 'string', + format: 'datetime', + description: 'The birth date of the owner of the account.', + }, + }, + }, }, }, AppBskyActorGetPreferences: { diff --git a/packages/api/src/client/types/app/bsky/actor/defs.ts b/packages/api/src/client/types/app/bsky/actor/defs.ts index f9ab03dcb81..7d3c9fcaac6 100644 --- a/packages/api/src/client/types/app/bsky/actor/defs.ts +++ b/packages/api/src/client/types/app/bsky/actor/defs.ts @@ -108,6 +108,7 @@ export type Preferences = ( | AdultContentPref | ContentLabelPref | SavedFeedsPref + | PersonalDetailsPref | { $type: string; [k: string]: unknown } )[] @@ -163,3 +164,21 @@ export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref { export function validateSavedFeedsPref(v: unknown): ValidationResult { return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v) } + +export interface PersonalDetailsPref { + /** The birth date of the owner of the account. */ + birthDate?: string + [k: string]: unknown +} + +export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.actor.defs#personalDetailsPref' + ) +} + +export function validatePersonalDetailsPref(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v) +} diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index e15d7aba1ce..193b9c39d37 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3714,6 +3714,7 @@ export const schemaDict = { 'lex:app.bsky.actor.defs#adultContentPref', 'lex:app.bsky.actor.defs#contentLabelPref', 'lex:app.bsky.actor.defs#savedFeedsPref', + 'lex:app.bsky.actor.defs#personalDetailsPref', ], }, }, @@ -3760,6 +3761,16 @@ export const schemaDict = { }, }, }, + personalDetailsPref: { + type: 'object', + properties: { + birthDate: { + type: 'string', + format: 'datetime', + description: 'The birth date of the owner of the account.', + }, + }, + }, }, }, AppBskyActorGetPreferences: { diff --git a/packages/bsky/src/lexicon/types/app/bsky/actor/defs.ts b/packages/bsky/src/lexicon/types/app/bsky/actor/defs.ts index 3b338c06f3a..4446c1f7a03 100644 --- a/packages/bsky/src/lexicon/types/app/bsky/actor/defs.ts +++ b/packages/bsky/src/lexicon/types/app/bsky/actor/defs.ts @@ -108,6 +108,7 @@ export type Preferences = ( | AdultContentPref | ContentLabelPref | SavedFeedsPref + | PersonalDetailsPref | { $type: string; [k: string]: unknown } )[] @@ -163,3 +164,21 @@ export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref { export function validateSavedFeedsPref(v: unknown): ValidationResult { return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v) } + +export interface PersonalDetailsPref { + /** The birth date of the owner of the account. */ + birthDate?: string + [k: string]: unknown +} + +export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.actor.defs#personalDetailsPref' + ) +} + +export function validatePersonalDetailsPref(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v) +} diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index e15d7aba1ce..193b9c39d37 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3714,6 +3714,7 @@ export const schemaDict = { 'lex:app.bsky.actor.defs#adultContentPref', 'lex:app.bsky.actor.defs#contentLabelPref', 'lex:app.bsky.actor.defs#savedFeedsPref', + 'lex:app.bsky.actor.defs#personalDetailsPref', ], }, }, @@ -3760,6 +3761,16 @@ export const schemaDict = { }, }, }, + personalDetailsPref: { + type: 'object', + properties: { + birthDate: { + type: 'string', + format: 'datetime', + description: 'The birth date of the owner of the account.', + }, + }, + }, }, }, AppBskyActorGetPreferences: { diff --git a/packages/pds/src/lexicon/types/app/bsky/actor/defs.ts b/packages/pds/src/lexicon/types/app/bsky/actor/defs.ts index 3b338c06f3a..4446c1f7a03 100644 --- a/packages/pds/src/lexicon/types/app/bsky/actor/defs.ts +++ b/packages/pds/src/lexicon/types/app/bsky/actor/defs.ts @@ -108,6 +108,7 @@ export type Preferences = ( | AdultContentPref | ContentLabelPref | SavedFeedsPref + | PersonalDetailsPref | { $type: string; [k: string]: unknown } )[] @@ -163,3 +164,21 @@ export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref { export function validateSavedFeedsPref(v: unknown): ValidationResult { return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v) } + +export interface PersonalDetailsPref { + /** The birth date of the owner of the account. */ + birthDate?: string + [k: string]: unknown +} + +export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'app.bsky.actor.defs#personalDetailsPref' + ) +} + +export function validatePersonalDetailsPref(v: unknown): ValidationResult { + return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v) +}