Skip to content

Commit

Permalink
Add personal-details user preference with birth date (#1565)
Browse files Browse the repository at this point in the history
* Add personal-details user preference with birth date

* Add personal details pref to settings union
  • Loading branch information
pfrazee authored Sep 8, 2023
1 parent 192392c commit 44b721b
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lexicons/app/bsky/actor/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@
"type": "array",
"items": {
"type": "union",
"refs": ["#adultContentPref", "#contentLabelPref", "#savedFeedsPref"]
"refs": [
"#adultContentPref",
"#contentLabelPref",
"#savedFeedsPref",
"#personalDetailsPref"
]
}
},
"adultContentPref": {
Expand Down Expand Up @@ -134,6 +139,16 @@
}
}
}
},
"personalDetailsPref": {
"type": "object",
"properties": {
"birthDate": {
"type": "string",
"format": "datetime",
"description": "The birth date of the owner of the account."
}
}
}
}
}
11 changes: 11 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
},
Expand Down Expand Up @@ -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: {
Expand Down
19 changes: 19 additions & 0 deletions packages/api/src/client/types/app/bsky/actor/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export type Preferences = (
| AdultContentPref
| ContentLabelPref
| SavedFeedsPref
| PersonalDetailsPref
| { $type: string; [k: string]: unknown }
)[]

Expand Down Expand Up @@ -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)
}
11 changes: 11 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
},
Expand Down Expand Up @@ -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: {
Expand Down
19 changes: 19 additions & 0 deletions packages/bsky/src/lexicon/types/app/bsky/actor/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export type Preferences = (
| AdultContentPref
| ContentLabelPref
| SavedFeedsPref
| PersonalDetailsPref
| { $type: string; [k: string]: unknown }
)[]

Expand Down Expand Up @@ -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)
}
11 changes: 11 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
},
Expand Down Expand Up @@ -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: {
Expand Down
19 changes: 19 additions & 0 deletions packages/pds/src/lexicon/types/app/bsky/actor/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export type Preferences = (
| AdultContentPref
| ContentLabelPref
| SavedFeedsPref
| PersonalDetailsPref
| { $type: string; [k: string]: unknown }
)[]

Expand Down Expand Up @@ -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)
}

0 comments on commit 44b721b

Please sign in to comment.