From 6b5070e6341de48f4d0a5b940b24a912a37c8997 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Tue, 17 Oct 2023 12:15:41 +0200 Subject: [PATCH] Add event changes API endpoint description --- lib/www/server/spec/openapi.yaml | 108 +++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/lib/www/server/spec/openapi.yaml b/lib/www/server/spec/openapi.yaml index 818f694..52b968e 100644 --- a/lib/www/server/spec/openapi.yaml +++ b/lib/www/server/spec/openapi.yaml @@ -180,6 +180,16 @@ components: required: true example: 14707 + Since: + description: Starting epoch + name: since + in: path + schema: + type: string + format: date-time + required: true + example: 1970-01-01T00:00:00Z + QueryLimit: description: Maximum number of results to return name: limit @@ -206,6 +216,16 @@ components: pattern: "(([^\\s,;:]+)(\\s*[,;:\\s]\\s*)?)+" example: "line,point,tstamp" + Unique: + description: | + Return unique results. Any value at all represents `true`. + name: unique + in: query + schema: + type: string + pattern: ".+" + example: "t" + schemas: Duration: @@ -602,14 +622,26 @@ components: Flag to indicate that this event is read-only. It cannot be edited by the user or deleted. Typically this concerns system-generated events such as QC results or midnight shots. additionalProperties: true + EventIDAbstract: + type: object + properties: + id: + type: number + description: Event ID. + + + EventUIDAbstract: + type: object + properties: + uid: + type: number + description: Event instance unique ID. When an event is modified, the new entry acquires a different `uid` while keeping the same `id` as the original event. + + EventAbstract: allOf: - - type: object - properties: - id: - type: number - description: Event ID. + $ref: "#/components/schemas/EventIDAbstract" - $ref: "#/components/schemas/EventNew" @@ -659,6 +691,47 @@ components: * The third element is either an ISO-8601 timestamp or `null`. The latter indicates +∞. These are the events returned by endpoints that do not concern themselves with event history. * The fourth element is one of `]` or `)`. As before, it indicates either an open or closed interval. + EventChangesIsDeletedAbstract: + type: object + properties: + is_deleted: + type: boolean + description: > + Flag to indicate whether this event or event instance (depending on the presence of a `uid` attribute) has been deleted. + + + EventChangesModified: + description: An event modification. + allOf: + - + $ref: "#/components/schemas/EventAbstract" + - + $ref: "#/components/schemas/EventChangesIsDeletedAbstract" + + EventChangesDeleted: + description: | + Identification of a deleted event or event instance. + + **Note:** the details of the deleted event are not included, only its `id` and `uid`. + allOf: + - + $ref: "#/components/schemas/EventIDAbstract" + - + $ref: "#/components/schemas/EventUIDAbstract" + - + $ref: "#/components/schemas/EventChangesIsDeletedAbstract" + + EventChanges: + description: List of event changes since the given epoch. + type: array + items: + anyOf: + - + $ref: "#/components/schemas/EventChangesDeleted" + - + $ref: "#/components/schemas/EventChangesModified" + + SeisExportEntryFSP: type: object properties: @@ -1382,6 +1455,31 @@ paths: $ref: "#/components/responses/401" + /project/{project}/changes/{since}: + get: + summary: Get event change history since epoch. + tags: [ "log" ] + security: + - BearerAuthGuest: [] + - CookieAuthGuest: [] + parameters: + - $ref: "#/components/parameters/Project" + - $ref: "#/components/parameters/Since" + - $ref: "#/components/parameters/Unique" + responses: + "200": + description: List of project event changes. If `unique` is given, only the latest version of each event will be returned, otherwise the entire modification history is given, potentially including the same event `id` multiple times. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/EventChanges" + + "401": + $ref: "#/components/responses/401" + + /project/{project}/label: get: summary: Get project labels.