@myronsi/messenger-api 2.1.0-alpha.4 → 2.1.0-alpha.5.next.70

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,12 @@
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.5
6
+
7
+ - A user's `avatar_url` adds `?rev={revision}`, which changes with every new avatar. `GET /users/{user_id}/avatar`
8
+ accepts `rev`; while it matches the current avatar, the answer is `Cache-Control: private, max-age=31536000, immutable`.
9
+ - `GET /attachments/{attachment_id}/content` is cached for a year (`immutable`): an attachment's bytes never change.
10
+
5
11
  ## 2.1.0-alpha.4
6
12
 
7
13
  - Editing a file message accepts an empty `content` (HTTP `PATCH /messages/{message_id}` and the WebSocket `edit`
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.4";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.5";
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.4";
1
+ export const API_VERSION = "2.1.0-alpha.5";
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.4
4
+ version: 2.1.0-alpha.5
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
@@ -825,12 +825,18 @@ paths:
825
825
  summary: Current avatar image
826
826
  description: |
827
827
  Respects the avatar visibility of the user; falls back to the default avatar. With `version`, an
828
- earlier avatar of the history (`AvatarVersion.url`).
828
+ earlier avatar of the history (`AvatarVersion.url`). `avatar_url` carries `rev`, the revision of the
829
+ current avatar: while it matches, the answer may be cached for a year (`immutable`), because a new
830
+ avatar gets a new `rev` and so a new URL.
829
831
  parameters:
830
832
  - name: version
831
833
  in: query
832
834
  description: "`id` of an `AvatarVersion` of this user."
833
835
  schema: { $ref: "#/components/schemas/Id" }
836
+ - name: rev
837
+ in: query
838
+ description: Revision of the current avatar, as given in `avatar_url`.
839
+ schema: { type: string, maxLength: 64 }
834
840
  responses:
835
841
  "426": { $ref: "#/components/responses/ClientOutdated" }
836
842
  "400": { $ref: "#/components/responses/BadRequest" }
@@ -2518,7 +2524,7 @@ components:
2518
2524
  description: The requesting user's own name for this user, if set.
2519
2525
  avatar_url:
2520
2526
  type: [string, "null"]
2521
- description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
2527
+ description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
2522
2528
  bio: { type: [string, "null"] }
2523
2529
  is_online: { type: boolean }
2524
2530
  last_seen:
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -681,7 +681,9 @@ export interface paths {
681
681
  /**
682
682
  * Current avatar image
683
683
  * @description Respects the avatar visibility of the user; falls back to the default avatar. With `version`, an
684
- * earlier avatar of the history (`AvatarVersion.url`).
684
+ * earlier avatar of the history (`AvatarVersion.url`). `avatar_url` carries `rev`, the revision of the
685
+ * current avatar: while it matches, the answer may be cached for a year (`immutable`), because a new
686
+ * avatar gets a new `rev` and so a new URL.
685
687
  */
686
688
  get: operations["getUserAvatar"];
687
689
  put?: never;
@@ -1756,7 +1758,7 @@ export interface components {
1756
1758
  display_name: string;
1757
1759
  /** @description The requesting user's own name for this user, if set. */
1758
1760
  contact_name?: string | null;
1759
- /** @description Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`). */
1761
+ /** @description Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`). */
1760
1762
  avatar_url: string | null;
1761
1763
  bio: string | null;
1762
1764
  is_online: boolean;
@@ -3195,6 +3197,8 @@ export interface operations {
3195
3197
  query?: {
3196
3198
  /** @description `id` of an `AvatarVersion` of this user. */
3197
3199
  version?: components["schemas"]["Id"];
3200
+ /** @description Revision of the current avatar, as given in `avatar_url`. */
3201
+ rev?: string;
3198
3202
  };
3199
3203
  header?: {
3200
3204
  /** @description Version of the client app, for logs and the per-client metric. */
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -253,7 +253,7 @@ export interface User {
253
253
  */
254
254
  contact_name?: string | null;
255
255
  /**
256
- * Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
256
+ * Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
257
257
  */
258
258
  avatar_url: string | null;
259
259
  bio: string | null;
@@ -979,7 +979,7 @@
979
979
  "string",
980
980
  "null"
981
981
  ],
982
- "description": "Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`)."
982
+ "description": "Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`)."
983
983
  },
984
984
  "bio": {
985
985
  "type": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.4",
3
+ "version": "2.1.0-alpha.5.next.70",
4
4
  "description": "API contract of the Messenger backend: OpenAPI document, WebSocket event schemas and generated TypeScript types",
5
5
  "license": "MIT",
6
6
  "repository": {