@myronsi/messenger-api 2.1.0-alpha.28 → 2.1.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  Contract changes only. The backend changelog is `CHANGELOG.md` in the repository root. Rules: `docs/api-compatibility.md`.
4
4
 
5
+ ## 2.1.0-alpha.29
6
+
7
+ - `User` gains the required `pronouns`, `birthday` (`Birthday`: day, month, optional year), `music`
8
+ (`ProfileMusic`) and `background` (`ProfileBackground`: an uploaded image, GIF or short video, a built-in preset or
9
+ one or two colors); all grow `profile_version`. `Me` gains the required `time_zone`.
10
+ - `PATCH /me` accepts `pronouns`, `birthday` and `time_zone`.
11
+ - `PUT`/`DELETE /me/music`, `PUT`/`DELETE /me/background`, `PUT`/`DELETE /groups/{chat_id}/background`.
12
+ `Group` gains the required `background`.
13
+ - `UploadPurpose` gains `profile_music` (cut to at most 30 s with the new `start_ms` and `end_ms`, tags in the new
14
+ `Attachment.tags`) and `profile_background`.
15
+ - `PrivacySettings` gains the required `birthday_visibility`; `birthday_visibility` is a new privacy exception key.
16
+ - `NotificationPreferences` gains the optional `birthday_reminders`.
17
+
5
18
  ## 2.1.0-alpha.28
6
19
 
7
20
  - `MediaKind` gains `voice` (voice messages only) and `link` (messages whose text or caption contains a web link) for
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.28. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.28";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.29. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.29";
3
3
  export type { paths, components, operations } from "./schema.js";
4
4
  export * from "./ws-events.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export const API_VERSION = "2.1.0-alpha.28";
1
+ export const API_VERSION = "2.1.0-alpha.29";
package/dist/openapi.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Messenger API
4
- version: 2.1.0-alpha.28
4
+ version: 2.1.0-alpha.29
5
5
  summary: REST contract of the Messenger backend (v2).
6
6
  description: |
7
7
  Contract for the Go backend. The WebSocket protocol is described in `websocket/` and
@@ -427,6 +427,77 @@ paths:
427
427
  "400": { $ref: "#/components/responses/BadRequest" }
428
428
  "401": { $ref: "#/components/responses/Unauthorized" }
429
429
  "404": { $ref: "#/components/responses/NotFound" }
430
+ /me/music:
431
+ parameters:
432
+ - $ref: "#/components/parameters/ClientVersion"
433
+ - $ref: "#/components/parameters/ClientApiVersion"
434
+ put:
435
+ tags: [me]
436
+ operationId: setMyMusic
437
+ summary: Set the profile music
438
+ description: "Upload the file with `POST /attachments` (`purpose: profile_music`) first."
439
+ requestBody:
440
+ required: true
441
+ content:
442
+ application/json:
443
+ schema: { $ref: "#/components/schemas/SetMusicRequest" }
444
+ responses:
445
+ "426": { $ref: "#/components/responses/ClientOutdated" }
446
+ "200":
447
+ description: Updated user
448
+ content:
449
+ application/json:
450
+ schema: { $ref: "#/components/schemas/Me" }
451
+ "400": { $ref: "#/components/responses/BadRequest" }
452
+ "401": { $ref: "#/components/responses/Unauthorized" }
453
+ "422": { $ref: "#/components/responses/ValidationFailed" }
454
+ delete:
455
+ tags: [me]
456
+ operationId: deleteMyMusic
457
+ summary: Remove the profile music
458
+ responses:
459
+ "426": { $ref: "#/components/responses/ClientOutdated" }
460
+ "200":
461
+ description: Updated user
462
+ content:
463
+ application/json:
464
+ schema: { $ref: "#/components/schemas/Me" }
465
+ "401": { $ref: "#/components/responses/Unauthorized" }
466
+ /me/background:
467
+ parameters:
468
+ - $ref: "#/components/parameters/ClientVersion"
469
+ - $ref: "#/components/parameters/ClientApiVersion"
470
+ put:
471
+ tags: [me]
472
+ operationId: setMyBackground
473
+ summary: Set the profile background
474
+ requestBody:
475
+ required: true
476
+ content:
477
+ application/json:
478
+ schema: { $ref: "#/components/schemas/SetBackgroundRequest" }
479
+ responses:
480
+ "426": { $ref: "#/components/responses/ClientOutdated" }
481
+ "200":
482
+ description: Updated user
483
+ content:
484
+ application/json:
485
+ schema: { $ref: "#/components/schemas/Me" }
486
+ "400": { $ref: "#/components/responses/BadRequest" }
487
+ "401": { $ref: "#/components/responses/Unauthorized" }
488
+ "422": { $ref: "#/components/responses/ValidationFailed" }
489
+ delete:
490
+ tags: [me]
491
+ operationId: deleteMyBackground
492
+ summary: Remove the profile background
493
+ responses:
494
+ "426": { $ref: "#/components/responses/ClientOutdated" }
495
+ "200":
496
+ description: Updated user
497
+ content:
498
+ application/json:
499
+ schema: { $ref: "#/components/schemas/Me" }
500
+ "401": { $ref: "#/components/responses/Unauthorized" }
430
501
  /me/password:
431
502
  parameters:
432
503
  - $ref: "#/components/parameters/ClientVersion"
@@ -653,7 +724,7 @@ paths:
653
724
  required: true
654
725
  schema:
655
726
  type: string
656
- enum: [avatar_visibility, profile_visibility, presence_visibility, last_seen_visibility, group_invites, direct_messages, search_visibility]
727
+ enum: [avatar_visibility, profile_visibility, presence_visibility, last_seen_visibility, birthday_visibility, group_invites, direct_messages, search_visibility]
657
728
  - name: effect
658
729
  in: path
659
730
  required: true
@@ -1858,6 +1929,49 @@ paths:
1858
1929
  "403": { $ref: "#/components/responses/Forbidden" }
1859
1930
  "404": { $ref: "#/components/responses/NotFound" }
1860
1931
  "422": { $ref: "#/components/responses/ValidationFailed" }
1932
+ /groups/{chat_id}/background:
1933
+ parameters:
1934
+ - $ref: "#/components/parameters/ClientVersion"
1935
+ - $ref: "#/components/parameters/ClientApiVersion"
1936
+ - $ref: "#/components/parameters/ChatId"
1937
+ put:
1938
+ tags: [groups]
1939
+ operationId: setGroupBackground
1940
+ summary: Set the group background
1941
+ description: |
1942
+ Owner and admins. For `media`, the caller uploads the file with purpose `profile_background` first.
1943
+ requestBody:
1944
+ required: true
1945
+ content:
1946
+ application/json:
1947
+ schema: { $ref: "#/components/schemas/SetBackgroundRequest" }
1948
+ responses:
1949
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1950
+ "400": { $ref: "#/components/responses/BadRequest" }
1951
+ "200":
1952
+ description: Updated group
1953
+ content:
1954
+ application/json:
1955
+ schema: { $ref: "#/components/schemas/Group" }
1956
+ "401": { $ref: "#/components/responses/Unauthorized" }
1957
+ "403": { $ref: "#/components/responses/Forbidden" }
1958
+ "404": { $ref: "#/components/responses/NotFound" }
1959
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1960
+ delete:
1961
+ tags: [groups]
1962
+ operationId: deleteGroupBackground
1963
+ summary: Remove the group background
1964
+ description: Owner and admins.
1965
+ responses:
1966
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1967
+ "200":
1968
+ description: Updated group
1969
+ content:
1970
+ application/json:
1971
+ schema: { $ref: "#/components/schemas/Group" }
1972
+ "401": { $ref: "#/components/responses/Unauthorized" }
1973
+ "403": { $ref: "#/components/responses/Forbidden" }
1974
+ "404": { $ref: "#/components/responses/NotFound" }
1861
1975
  /groups/{chat_id}/participants:
1862
1976
  parameters:
1863
1977
  - $ref: "#/components/parameters/ClientVersion"
@@ -4473,6 +4587,11 @@ components:
4473
4587
  type: boolean
4474
4588
  previews:
4475
4589
  type: boolean
4590
+ birthday_reminders:
4591
+ type: boolean
4592
+ description: |
4593
+ A push at 09:00 (in `Me.time_zone`) when someone you have a direct chat with has a birthday. Always sent
4594
+ by the server; when a `PUT` leaves it out, it stays as it is. Defaults to `true`.
4476
4595
  NotificationSettings:
4477
4596
  type: object
4478
4597
  required:
@@ -4790,6 +4909,18 @@ components:
4790
4909
  properties:
4791
4910
  display_name: { type: string, minLength: 1, maxLength: 64 }
4792
4911
  bio: { type: [string, "null"], maxLength: 500 }
4912
+ pronouns:
4913
+ type: [string, "null"]
4914
+ maxLength: 40
4915
+ description: Free text; `null` or an empty string removes it.
4916
+ birthday:
4917
+ description: |
4918
+ `null` removes it. With a `year` the date must exist (no 29 February in other years); without one,
4919
+ 29 February is allowed.
4920
+ oneOf:
4921
+ - $ref: "#/components/schemas/Birthday"
4922
+ - type: "null"
4923
+ time_zone: { $ref: "#/components/schemas/TimeZone" }
4793
4924
  SetAvatarRequest:
4794
4925
  type: object
4795
4926
  required: [attachment_id]
@@ -4900,6 +5031,7 @@ components:
4900
5031
  - profile_visibility
4901
5032
  - presence_visibility
4902
5033
  - last_seen_visibility
5034
+ - birthday_visibility
4903
5035
  - read_receipts_enabled
4904
5036
  - direct_messages
4905
5037
  - group_invites
@@ -4916,6 +5048,9 @@ components:
4916
5048
  last_seen_visibility:
4917
5049
  description: Who sees when the user was last online (`User.last_seen`, `presence` events).
4918
5050
  allOf: [{ $ref: "#/components/schemas/Visibility" }]
5051
+ birthday_visibility:
5052
+ description: Who sees the birthday (`User.birthday`) and gets a reminder on the day. Defaults to `contacts`.
5053
+ allOf: [{ $ref: "#/components/schemas/Visibility" }]
4919
5054
  read_receipts_enabled: { type: boolean }
4920
5055
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
4921
5056
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
@@ -4935,6 +5070,7 @@ components:
4935
5070
  profile_visibility: { $ref: "#/components/schemas/Visibility" }
4936
5071
  presence_visibility: { $ref: "#/components/schemas/Visibility" }
4937
5072
  last_seen_visibility: { $ref: "#/components/schemas/Visibility" }
5073
+ birthday_visibility: { $ref: "#/components/schemas/Visibility" }
4938
5074
  read_receipts_enabled: { type: boolean }
4939
5075
  direct_messages: { $ref: "#/components/schemas/DirectMessagePolicy" }
4940
5076
  group_invites: { $ref: "#/components/schemas/GroupInvitePolicy" }
@@ -4954,13 +5090,34 @@ components:
4954
5090
  User:
4955
5091
  type: object
4956
5092
  description: A user as visible to the requesting user; hidden fields are `null`.
4957
- required: [id, username, display_name, avatar_url, bio, is_online, last_seen, is_deleted, profile_version]
5093
+ required: [id, username, display_name, avatar_url, bio, pronouns, birthday, music, background, is_online, last_seen, is_deleted, profile_version]
4958
5094
  properties:
4959
5095
  id: { $ref: "#/components/schemas/Id" }
4960
5096
  profile_version:
4961
5097
  type: integer
4962
5098
  minimum: 0
4963
- description: Grows whenever the username, display name, bio or avatar changes (not with presence). Clients keep a stored profile until a higher version arrives.
5099
+ description: |
5100
+ Grows whenever the username, display name, bio, avatar, pronouns, birthday, profile music or profile
5101
+ background changes (not with presence). Clients keep a stored profile until a higher version arrives.
5102
+ pronouns:
5103
+ type: [string, "null"]
5104
+ maxLength: 40
5105
+ description: Free text such as "she/her". Visible like the bio (`profile_visibility`).
5106
+ birthday:
5107
+ description: Visible by `birthday_visibility`; `null` when not set or hidden.
5108
+ oneOf:
5109
+ - $ref: "#/components/schemas/Birthday"
5110
+ - type: "null"
5111
+ music:
5112
+ description: A short song on the profile, visible like the bio. Clients never play it on their own.
5113
+ oneOf:
5114
+ - $ref: "#/components/schemas/ProfileMusic"
5115
+ - type: "null"
5116
+ background:
5117
+ description: The banner and page background of the profile, visible like the bio.
5118
+ oneOf:
5119
+ - $ref: "#/components/schemas/ProfileBackground"
5120
+ - type: "null"
4964
5121
  username: { $ref: "#/components/schemas/Username" }
4965
5122
  display_name: { type: string }
4966
5123
  contact_name:
@@ -4980,10 +5137,99 @@ components:
4980
5137
  allOf:
4981
5138
  - $ref: "#/components/schemas/User"
4982
5139
  - type: object
4983
- required: [created_at]
5140
+ required: [created_at, time_zone]
4984
5141
  properties:
4985
5142
  created_at: { $ref: "#/components/schemas/Timestamp" }
4986
5143
  recovery_setup_required: { type: boolean }
5144
+ time_zone:
5145
+ allOf: [{ $ref: "#/components/schemas/TimeZone" }]
5146
+ description: The user's time zone; birthday reminders arrive at 09:00 in it. `UTC` until a client sets it.
5147
+ TimeZone:
5148
+ type: string
5149
+ minLength: 1
5150
+ maxLength: 64
5151
+ description: An IANA time zone name such as `Europe/Berlin`.
5152
+ examples: [Europe/Berlin]
5153
+ Birthday:
5154
+ type: object
5155
+ required: [day, month, year]
5156
+ properties:
5157
+ day: { type: integer, minimum: 1, maximum: 31 }
5158
+ month: { type: integer, minimum: 1, maximum: 12 }
5159
+ year:
5160
+ type: [integer, "null"]
5161
+ minimum: 1900
5162
+ maximum: 2100
5163
+ description: Optional; `null` when the user keeps the year to themselves.
5164
+ ProfileMusic:
5165
+ type: object
5166
+ required: [attachment, title, artist]
5167
+ properties:
5168
+ attachment:
5169
+ allOf: [{ $ref: "#/components/schemas/Attachment" }]
5170
+ description: The clip (at most 30 s). `thumbnail_url` is the cover when the file had one.
5171
+ title: { type: [string, "null"], maxLength: 100 }
5172
+ artist: { type: [string, "null"], maxLength: 100 }
5173
+ ProfileBackgroundKind:
5174
+ type: string
5175
+ description: |
5176
+ `media` an uploaded image, GIF or short video (`attachment`), `preset` one of the clients' built-in
5177
+ gradients (`preset`), `color` one color or a gradient of two (`colors`).
5178
+ enum: [media, preset, color]
5179
+ BackgroundPreset:
5180
+ type: string
5181
+ pattern: "^[a-z0-9_-]{1,32}$"
5182
+ description: Name of a built-in gradient. Clients show their default background for a name they do not know.
5183
+ BackgroundColor:
5184
+ type: string
5185
+ pattern: "^#[0-9a-f]{6}$"
5186
+ examples: ["#3366ff"]
5187
+ ProfileBackground:
5188
+ type: object
5189
+ required: [kind]
5190
+ properties:
5191
+ kind: { $ref: "#/components/schemas/ProfileBackgroundKind" }
5192
+ attachment:
5193
+ allOf: [{ $ref: "#/components/schemas/Attachment" }]
5194
+ description: |
5195
+ Set for `media`. An image, an animated GIF or a muted video of at most 15 s; `thumbnail_url` is a still
5196
+ frame to show while it loads and when the viewer prefers reduced motion.
5197
+ preset: { $ref: "#/components/schemas/BackgroundPreset" }
5198
+ colors:
5199
+ type: array
5200
+ minItems: 1
5201
+ maxItems: 2
5202
+ items: { $ref: "#/components/schemas/BackgroundColor" }
5203
+ SetBackgroundRequest:
5204
+ type: object
5205
+ required: [kind]
5206
+ description: |
5207
+ `media` needs `attachment_id` (uploaded with purpose `profile_background`), `preset` needs `preset`, `color`
5208
+ needs `colors`; other fields must be absent (`422` otherwise).
5209
+ properties:
5210
+ kind: { $ref: "#/components/schemas/ProfileBackgroundKind" }
5211
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
5212
+ preset: { $ref: "#/components/schemas/BackgroundPreset" }
5213
+ colors:
5214
+ type: array
5215
+ minItems: 1
5216
+ maxItems: 2
5217
+ items: { $ref: "#/components/schemas/BackgroundColor" }
5218
+ SetMusicRequest:
5219
+ type: object
5220
+ required: [attachment_id]
5221
+ properties:
5222
+ attachment_id:
5223
+ allOf: [{ $ref: "#/components/schemas/AttachmentRef" }]
5224
+ description: An upload of the caller with purpose `profile_music`.
5225
+ title:
5226
+ type: [string, "null"]
5227
+ maxLength: 100
5228
+ description: Shown title. Clients fill it in from `Attachment.tags` of the upload and let the user edit it.
5229
+ artist:
5230
+ type: [string, "null"]
5231
+ maxLength: 100
5232
+ description: Shown artist, filled in the same way.
4987
5233
  UserPage:
4988
5234
  type: object
4989
5235
  required: [items, next_cursor]
@@ -5015,7 +5261,14 @@ components:
5015
5261
  `sticker`: a PNG, JPEG or still WebP of at most 5 MB. The server fits it into 512 x 512 px with a transparent
5016
5262
  border and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is
5017
5263
  added to a pack.
5018
- enum: [message, avatar, sticker]
5264
+
5265
+ `profile_music`: an audio file of at most 20 MB. The server keeps at most 30 s of it (from `start_ms` to
5266
+ `end_ms`, or the first 30 s), stored as AAC, reads the title and artist into `tags` and the embedded cover
5267
+ into `thumbnail_url`. Use it with `PUT /me/music`.
5268
+
5269
+ `profile_background`: an image (10 MB), an animated GIF (15 MB) or a video of at most 15 s (15 MB). Use it
5270
+ with `PUT /me/background` or `PUT /groups/{chat_id}/background`.
5271
+ enum: [message, avatar, sticker, profile_music, profile_background]
5019
5272
  UploadAttachmentRequest:
5020
5273
  type: object
5021
5274
  required: [file, purpose]
@@ -5034,6 +5287,14 @@ components:
5034
5287
  description: Amplitude samples (0-255) of a voice message
5035
5288
  maxItems: 128
5036
5289
  items: { type: integer, minimum: 0, maximum: 255 }
5290
+ start_ms:
5291
+ type: integer
5292
+ minimum: 0
5293
+ description: "`profile_music` only: where the kept part starts."
5294
+ end_ms:
5295
+ type: integer
5296
+ minimum: 1
5297
+ description: "`profile_music` only: where the kept part ends, at most 30 s after `start_ms`."
5037
5298
  Attachment:
5038
5299
  type: object
5039
5300
  required: [id, kind, filename, content_type, size, url]
@@ -5063,12 +5324,21 @@ components:
5063
5324
  waveform:
5064
5325
  type: [array, "null"]
5065
5326
  items: { type: integer, minimum: 0, maximum: 255 }
5327
+ tags:
5328
+ description: Only in the answer to a `profile_music` upload; what the file says about itself.
5329
+ $ref: "#/components/schemas/AudioTags"
5066
5330
  drawing:
5067
5331
  description: |
5068
5332
  What the sender drew on this image of this message. Clients show the image with the drawing on top
5069
5333
  and never without it. Absent when the image has no drawing. The same image can carry another drawing
5070
5334
  in another message.
5071
5335
  $ref: "#/components/schemas/Drawing"
5336
+ AudioTags:
5337
+ type: object
5338
+ required: [title, artist]
5339
+ properties:
5340
+ title: { type: [string, "null"], maxLength: 100 }
5341
+ artist: { type: [string, "null"], maxLength: 100 }
5072
5342
  Drawing:
5073
5343
  type: object
5074
5344
  description: |
@@ -5775,12 +6045,17 @@ components:
5775
6045
  joined_at: { $ref: "#/components/schemas/Timestamp" }
5776
6046
  Group:
5777
6047
  type: object
5778
- required: [id, name, description, avatar_url, owner_id, my_role, members, created_at]
6048
+ required: [id, name, description, avatar_url, background, owner_id, my_role, members, created_at]
5779
6049
  properties:
5780
6050
  id: { $ref: "#/components/schemas/Id" }
5781
6051
  name: { type: string, minLength: 1, maxLength: 64 }
5782
6052
  description: { type: [string, "null"], maxLength: 500 }
5783
6053
  avatar_url: { type: [string, "null"] }
6054
+ background:
6055
+ description: The banner and page background of the group profile; set by the owner and admins.
6056
+ oneOf:
6057
+ - $ref: "#/components/schemas/ProfileBackground"
6058
+ - type: "null"
5784
6059
  owner_id: { $ref: "#/components/schemas/Id" }
5785
6060
  my_role: { $ref: "#/components/schemas/GroupRole" }
5786
6061
  members: