Skip to content

Commit 4dc56c3

Browse files
committed
Update OpenAPI spec
1 parent 3e2bab2 commit 4dc56c3

2 files changed

Lines changed: 69 additions & 3 deletions

File tree

openapi/admin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.1.0
22
info:
33
title: Trophy
4-
version: '1.12.0'
4+
version: '1.13.0'
55
paths:
66
/attributes:
77
servers:

openapi/application.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.1.0
22
info:
33
title: Trophy
4-
version: '1.12.0'
4+
version: '1.13.0'
55
paths:
66
/achievements:
77
servers:
@@ -1026,7 +1026,10 @@ paths:
10261026
security:
10271027
- ApiKeyAuth: []
10281028
patch:
1029-
description: Update a user's notification preferences.
1029+
description: >-
1030+
Update a user's notification and streak preferences. Streak preferences
1031+
require streak customization to be enabled in your Trophy dashboard
1032+
settings.
10301033
operationId: users_update_preferences
10311034
x-fern-server-name: api
10321035
tags:
@@ -1106,12 +1109,24 @@ paths:
11061109
- email
11071110
- push
11081111
streak_reminder: []
1112+
streak:
1113+
evaluationMode: OR
1114+
metrics:
1115+
- key: words-written
1116+
threshold: 500
11091117
'401':
11101118
description: 'Unauthorized'
11111119
content:
11121120
application/json:
11131121
schema:
11141122
$ref: '#/components/schemas/ErrorBody'
1123+
'403':
1124+
description: >-
1125+
Streak customization is not enabled for this organisation
1126+
content:
1127+
application/json:
1128+
schema:
1129+
$ref: '#/components/schemas/ErrorBody'
11151130
'404':
11161131
description: 'User not found'
11171132
content:
@@ -1149,6 +1164,13 @@ paths:
11491164
achievement_completed:
11501165
- email
11511166
- push
1167+
Personalize streak settings:
1168+
value:
1169+
streak:
1170+
evaluationMode: OR
1171+
metrics:
1172+
- key: words-written
1173+
threshold: 500
11521174
/users/{id}/metrics:
11531175
servers:
11541176
- url: https://api.trophy.so/v1
@@ -5390,13 +5412,55 @@ components:
53905412
items:
53915413
$ref: '#/components/schemas/NotificationChannel'
53925414
description: Channels to receive streak reminder notifications on.
5415+
StreakEvaluationModePreference:
5416+
title: StreakEvaluationModePreference
5417+
type: string
5418+
enum:
5419+
- OR
5420+
- AND
5421+
description: >-
5422+
Whether meeting any single metric threshold (`OR`) or all configured
5423+
metric thresholds (`AND`) extends the user's streak. Matches the
5424+
evaluation mode configured in dashboard streak settings.
5425+
StreakMetricPreference:
5426+
title: StreakMetricPreference
5427+
type: object
5428+
description: Per-metric streak threshold override for a user.
5429+
properties:
5430+
key:
5431+
type: string
5432+
description: The metric key.
5433+
example: words-written
5434+
threshold:
5435+
type: number
5436+
description: Minimum metric change in a streak period to count toward the streak.
5437+
example: 500
5438+
required:
5439+
- key
5440+
- threshold
5441+
StreakPreferences:
5442+
title: StreakPreferences
5443+
type: object
5444+
description: >-
5445+
Per-user streak configuration. Requires streak customization to be
5446+
enabled in dashboard settings.
5447+
properties:
5448+
evaluationMode:
5449+
$ref: '#/components/schemas/StreakEvaluationModePreference'
5450+
metrics:
5451+
type: array
5452+
items:
5453+
$ref: '#/components/schemas/StreakMetricPreference'
5454+
description: Metrics and thresholds that count toward this user's streak.
53935455
UserPreferencesResponse:
53945456
title: UserPreferencesResponse
53955457
type: object
53965458
description: A user's preferences.
53975459
properties:
53985460
notifications:
53995461
$ref: '#/components/schemas/NotificationPreferences'
5462+
streak:
5463+
$ref: '#/components/schemas/StreakPreferences'
54005464
required:
54015465
- notifications
54025466
UpdateUserPreferencesRequest:
@@ -5406,6 +5470,8 @@ components:
54065470
properties:
54075471
notifications:
54085472
$ref: '#/components/schemas/NotificationPreferences'
5473+
streak:
5474+
$ref: '#/components/schemas/StreakPreferences'
54095475
ErrorBody:
54105476
title: ErrorBody
54115477
type: object

0 commit comments

Comments
 (0)