From 262745c545073d3ef8b10918f06aea8e1be62948 Mon Sep 17 00:00:00 2001 From: Topper Date: Wed, 23 Oct 2024 21:23:50 +0100 Subject: [PATCH 1/8] chore(swagger): Update v2 swagger --- restapi/versions/v2.json | 344 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 343 insertions(+), 1 deletion(-) diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index ecba7e58..06406450 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -217,6 +217,76 @@ } } }, + "/users": { + "get": { + "security": [ + { + "Auth": [ + "users|read" + ] + } + ], + "description": "Get users", + "tags": [ + "Users" + ], + "operationId": "getUsers", + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + } + } + }, + "x-axiom-preview": true + }, + "post": { + "security": [ + { + "Auth": [ + "users|create" + ] + } + ], + "description": "Create user", + "tags": [ + "Users" + ], + "operationId": "createUser", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-not-suspended": true, + "x-axiom-preview": true + } + }, "/tokens": { "get": { "security": [ @@ -482,6 +552,16 @@ } }, "requestBodies": { + "PostOrg": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostOrg" + } + } + }, + "required": true + }, "Monitor": { "content": { "application/json": { @@ -554,6 +634,9 @@ }, "orgCapabilities": { "$ref": "#/components/schemas/orgCapabilities" + }, + "samlAuthenticated": { + "type": "boolean" } } }, @@ -695,7 +778,7 @@ ], "properties": { "Modules": { - "description": "Modules is an optional set of module names => module sources that will be available to this query", + "description": "Key-value pairs of module names and module sources. Axiom will make modules available for this query later.", "type": "object", "additionalProperties": { "type": "string" @@ -1033,6 +1116,54 @@ } } }, + "ExternalPlan": { + "type": "object", + "required": [ + "state" + ], + "properties": { + "endingBefore": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "nextBillingDate": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "planID": { + "type": "string" + }, + "planInstanceID": { + "type": "string" + }, + "startingOn": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "state": { + "type": "string", + "enum": [ + "active", + "inTrial", + "incubation", + "sunset", + "migration", + "empty" + ] + }, + "trialEndingBefore": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "trialed": { + "type": "boolean" + } + } + }, "FieldInfo": { "type": "object", "title": "FieldInfo captures information about a field used in the tabular result format. See Table.", @@ -1057,6 +1188,131 @@ } } }, + "License": { + "type": "object", + "required": [ + "id", + "tier", + "issuer", + "issuedTo", + "issuedAt", + "validFrom", + "monthlyIngestGb", + "monthlyQueryGbHours", + "apiRateLimitPerSecond", + "maxUsers", + "maxTeams", + "maxDatasets", + "maxMonitors", + "maxFields", + "maxEndpoints", + "maxQueryWindowSeconds", + "maxAuditWindowSeconds", + "withRBAC", + "withAuths", + "features" + ], + "properties": { + "apiRateLimitPerSecond": { + "type": "integer", + "format": "uint64" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "features": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "id": { + "type": "string" + }, + "issuedAt": { + "type": "string", + "format": "date-time" + }, + "issuedTo": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "maxAuditWindowSeconds": { + "type": "integer", + "format": "uint64" + }, + "maxDatasets": { + "type": "integer", + "format": "uint64" + }, + "maxEndpoints": { + "type": "integer", + "format": "uint64" + }, + "maxFields": { + "type": "integer", + "format": "uint64" + }, + "maxMonitors": { + "type": "integer", + "format": "uint64" + }, + "maxQueryWindowSeconds": { + "type": "integer", + "format": "uint64" + }, + "maxTeams": { + "type": "integer", + "format": "uint64" + }, + "maxUsers": { + "type": "integer", + "format": "uint64" + }, + "monthlyIngestGb": { + "type": "integer", + "format": "uint64" + }, + "monthlyQueryGbHours": { + "type": "integer", + "format": "uint64" + }, + "monthlyStorageGb": { + "type": "integer", + "format": "uint64" + }, + "tier": { + "type": "string", + "enum": [ + "personal", + "basicDirect", + "teamMonthlyDirect", + "teamMonthlyAws", + "growth", + "teamPlus", + "enterprise", + "comped" + ] + }, + "validFrom": { + "type": "string", + "format": "date-time" + }, + "withAuths": { + "type": "array", + "items": { + "type": "string" + } + }, + "withRBAC": { + "type": "boolean" + } + } + }, "Message": { "type": "object", "required": [ @@ -1337,6 +1593,81 @@ } } }, + "Org": { + "type": "object", + "required": [ + "id", + "name", + "plan", + "planCreated", + "lastUsageSync", + "paymentStatus", + "role", + "primaryEmail", + "license", + "externalPlan" + ], + "properties": { + "externalPlan": { + "$ref": "#/components/schemas/ExternalPlan" + }, + "firstFailedPayment": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastUsageSync": { + "type": "string" + }, + "license": { + "$ref": "#/components/schemas/License" + }, + "metaCreated": { + "type": "string" + }, + "metaModified": { + "type": "string" + }, + "metaVersion": { + "type": "string" + }, + "name": { + "type": "string" + }, + "paymentStatus": { + "type": "string", + "enum": [ + "na", + "failed", + "success", + "blocked" + ] + }, + "plan": { + "type": "string", + "enum": [ + "personal", + "basicDirect", + "teamMonthlyDirect", + "teamMonthlyAws", + "growth", + "teamPlus", + "enterprise", + "comped" + ] + }, + "planCreated": { + "type": "string" + }, + "primaryEmail": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, "PagerDutyConfig": { "properties": { "routingKey": { @@ -1347,6 +1678,17 @@ } } }, + "PostOrg": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + }, "RangeInfo": { "type": "object", "title": "RangeInfo specifies the window a query was restricted to.", From c9cec0cf77ad3e5be41e7f01d72a9b19ee34b2be Mon Sep 17 00:00:00 2001 From: Topper Date: Tue, 29 Oct 2024 14:31:42 +0000 Subject: [PATCH 2/8] Add pages for users and update swagger version --- restapi/endpoints/createUser.mdx | 4 ++++ restapi/endpoints/deleteUser.mdx | 4 ++++ restapi/endpoints/getUser.mdx | 4 ++++ restapi/endpoints/getUsers.mdx | 4 ++++ restapi/endpoints/updateUser.mdx | 4 ++++ 5 files changed, 20 insertions(+) create mode 100644 restapi/endpoints/createUser.mdx create mode 100644 restapi/endpoints/deleteUser.mdx create mode 100644 restapi/endpoints/getUser.mdx create mode 100644 restapi/endpoints/getUsers.mdx create mode 100644 restapi/endpoints/updateUser.mdx diff --git a/restapi/endpoints/createUser.mdx b/restapi/endpoints/createUser.mdx new file mode 100644 index 00000000..33f5bc99 --- /dev/null +++ b/restapi/endpoints/createUser.mdx @@ -0,0 +1,4 @@ +--- +title: Create user +openapi: "v2 post /users" +--- \ No newline at end of file diff --git a/restapi/endpoints/deleteUser.mdx b/restapi/endpoints/deleteUser.mdx new file mode 100644 index 00000000..b6825a7c --- /dev/null +++ b/restapi/endpoints/deleteUser.mdx @@ -0,0 +1,4 @@ +--- +title: Delete user +openapi: "v2 delete /users/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getUser.mdx b/restapi/endpoints/getUser.mdx new file mode 100644 index 00000000..d4e7550a --- /dev/null +++ b/restapi/endpoints/getUser.mdx @@ -0,0 +1,4 @@ +--- +title: Get user +openapi: "v2 get /users/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getUsers.mdx b/restapi/endpoints/getUsers.mdx new file mode 100644 index 00000000..4c93f743 --- /dev/null +++ b/restapi/endpoints/getUsers.mdx @@ -0,0 +1,4 @@ +--- +title: Get users +openapi: "v2 get /users" +--- \ No newline at end of file diff --git a/restapi/endpoints/updateUser.mdx b/restapi/endpoints/updateUser.mdx new file mode 100644 index 00000000..4cf8b956 --- /dev/null +++ b/restapi/endpoints/updateUser.mdx @@ -0,0 +1,4 @@ +--- +title: Update user +openapi: "v2 put /users/{id}" +--- \ No newline at end of file From 66cd18401c94c7022dbec938dd5895ad9d6a2e82 Mon Sep 17 00:00:00 2001 From: Topper Date: Tue, 29 Oct 2024 14:31:53 +0000 Subject: [PATCH 3/8] Add pages for users and update swagger version --- restapi/versions/v2.json | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index 06406450..d5584436 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -287,6 +287,122 @@ "x-axiom-preview": true } }, + "/users/{id}": { + "get": { + "security": [ + { + "Auth": [ + "users|read" + ] + } + ], + "description": "Get user by ID", + "tags": [ + "Users" + ], + "operationId": "getUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "users|update" + ] + } + ], + "description": "Update user", + "tags": [ + "Users" + ], + "operationId": "updateUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "users|delete" + ] + } + ], + "description": "Delete user", + "tags": [ + "Users" + ], + "operationId": "deleteUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + }, + "x-axiom-preview": true + } + }, "/tokens": { "get": { "security": [ From 5e6de26740499e78a2069852dfad992487f6da42 Mon Sep 17 00:00:00 2001 From: Topper Date: Tue, 29 Oct 2024 14:42:19 +0000 Subject: [PATCH 4/8] add to mint --- mint.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mint.json b/mint.json index 61b02168..5feaed3b 100644 --- a/mint.json +++ b/mint.json @@ -343,7 +343,12 @@ { "group": "User Endpoints", "pages": [ - "restapi/endpoints/getCurrentUser" + "restapi/endpoints/getCurrentUser", + "restapi/endpoints/getUsers", + "restapi/endpoints/getUser", + "restapi/endpoints/createUser", + "restapi/endpoints/updateUser", + "restapi/endpoints/deleteUser" ] }, { From 4a83425fe149ba3bfe93de42e49e9a8a37b80d1c Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 30 Oct 2024 09:17:02 +0100 Subject: [PATCH 5/8] Align wording --- restapi/endpoints/getUser.mdx | 2 +- restapi/endpoints/getUsers.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/restapi/endpoints/getUser.mdx b/restapi/endpoints/getUser.mdx index d4e7550a..59c60bef 100644 --- a/restapi/endpoints/getUser.mdx +++ b/restapi/endpoints/getUser.mdx @@ -1,4 +1,4 @@ --- -title: Get user +title: Retrieve user openapi: "v2 get /users/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getUsers.mdx b/restapi/endpoints/getUsers.mdx index 4c93f743..b049f00b 100644 --- a/restapi/endpoints/getUsers.mdx +++ b/restapi/endpoints/getUsers.mdx @@ -1,4 +1,4 @@ --- -title: Get users +title: List all users openapi: "v2 get /users" --- \ No newline at end of file From 2f73305f82e40f8abb2f0b81cd49e4879c6a31b0 Mon Sep 17 00:00:00 2001 From: Topper Date: Wed, 30 Oct 2024 09:50:24 +0000 Subject: [PATCH 6/8] Update getCurrentUser to use v2 --- restapi/endpoints/getCurrentUser.mdx | 2 +- restapi/versions/v2.json | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/restapi/endpoints/getCurrentUser.mdx b/restapi/endpoints/getCurrentUser.mdx index a2609929..08a1e80e 100644 --- a/restapi/endpoints/getCurrentUser.mdx +++ b/restapi/endpoints/getCurrentUser.mdx @@ -1,4 +1,4 @@ --- title: Retrieve current user -openapi: "v1 get /user" +openapi: "v2 get /user" --- \ No newline at end of file diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index d5584436..77e73be9 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -217,6 +217,28 @@ } } }, + "/user": { + "get": { + "description": "Get current user", + "tags": [ + "Users" + ], + "operationId": "getCurrentUser", + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-preview": true + } + }, "/users": { "get": { "security": [ From 28cc4b1c82254e843e29c6ac2e9e6bdf218d1c48 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Mon, 4 Nov 2024 14:30:21 +0100 Subject: [PATCH 7/8] Add disclaimer to update user --- mint.json | 46 ++++++++++++++++---------------- restapi/endpoints/updateUser.mdx | 8 +++++- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/mint.json b/mint.json index a415cce1..86d3c1a4 100644 --- a/mint.json +++ b/mint.json @@ -421,14 +421,23 @@ ] }, { - "group": "User endpoints", + "group": "Annotation endpoints", "pages": [ - "restapi/endpoints/getCurrentUser", - "restapi/endpoints/getUsers", - "restapi/endpoints/getUser", - "restapi/endpoints/createUser", - "restapi/endpoints/updateUser", - "restapi/endpoints/deleteUser" + "restapi/endpoints/getAnnotations", + "restapi/endpoints/getAnnotation", + "restapi/endpoints/createAnnotation", + "restapi/endpoints/updateAnnotation", + "restapi/endpoints/deleteAnnotation" + ] + }, + { + "group": "API token endpoints", + "pages": [ + "restapi/endpoints/getTokens", + "restapi/endpoints/getToken", + "restapi/endpoints/createToken", + "restapi/endpoints/regenerateToken", + "restapi/endpoints/deleteToken" ] }, { @@ -446,23 +455,14 @@ ] }, { - "group": "Annotation endpoints", - "pages": [ - "restapi/endpoints/getAnnotations", - "restapi/endpoints/getAnnotation", - "restapi/endpoints/createAnnotation", - "restapi/endpoints/updateAnnotation", - "restapi/endpoints/deleteAnnotation" - ] - }, - { - "group": "API token endpoints", + "group": "User endpoints", "pages": [ - "restapi/endpoints/getTokens", - "restapi/endpoints/getToken", - "restapi/endpoints/createToken", - "restapi/endpoints/regenerateToken", - "restapi/endpoints/deleteToken" + "restapi/endpoints/getCurrentUser", + "restapi/endpoints/getUsers", + "restapi/endpoints/getUser", + "restapi/endpoints/createUser", + "restapi/endpoints/updateUser", + "restapi/endpoints/deleteUser" ] } ], diff --git a/restapi/endpoints/updateUser.mdx b/restapi/endpoints/updateUser.mdx index 4cf8b956..cc42c721 100644 --- a/restapi/endpoints/updateUser.mdx +++ b/restapi/endpoints/updateUser.mdx @@ -1,4 +1,10 @@ --- title: Update user openapi: "v2 put /users/{id}" ---- \ No newline at end of file +--- + + +Using this endpoint, you can change the name of your own user. Authorize the request with a [personal access token (PAT)](/reference/tokens). + +You cannot change the names of other users, you cannot change other properties than your name, and you cannot use an API token to authorize the request. + \ No newline at end of file From 171f6f5d27e9cff3991b0d351508819d3fc52b52 Mon Sep 17 00:00:00 2001 From: Mano Toth <71388581+tothmano@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:55:09 +0100 Subject: [PATCH 8/8] Update restapi/endpoints/updateUser.mdx --- restapi/endpoints/updateUser.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restapi/endpoints/updateUser.mdx b/restapi/endpoints/updateUser.mdx index cc42c721..0ca09c7a 100644 --- a/restapi/endpoints/updateUser.mdx +++ b/restapi/endpoints/updateUser.mdx @@ -6,5 +6,5 @@ openapi: "v2 put /users/{id}" Using this endpoint, you can change the name of your own user. Authorize the request with a [personal access token (PAT)](/reference/tokens). -You cannot change the names of other users, you cannot change other properties than your name, and you cannot use an API token to authorize the request. +You cannot change the names of other users, you cannot change properties other than your name, and you cannot use an API token to authorize the request. \ No newline at end of file