fix the api and disable the automation (#172)

This commit is contained in:
pascal-fischer
2024-03-19 10:13:43 +01:00
committed by GitHub
parent 3012df5f57
commit a3eb5be0f8
14 changed files with 5214 additions and 567 deletions

View File

@@ -11,7 +11,7 @@ export const title = 'Users'
#### Query Parameters
<Properties>
<Property name="service_user" type="" required={false}>
<Property name="service_user" type="boolean" required={false}>
Filters users and returns either regular users or service users
</Property>
</Properties>
@@ -168,18 +168,42 @@ echo $response;
<CodeGroup title="Response">
```json {{ title: 'Example' }}
{
"items": {
"$ref": "#/components/schemas/User"
[
{
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"last_login": "2023-05-05T09:00:35.477782Z",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_current": true,
"is_service_user": false,
"is_blocked": false,
"issued": "api"
}
}
]
```
```json {{ title: 'Schema' }}
{
"items": {
"$ref": "#/components/schemas/User"
[
{
"id": "string",
"email": "string",
"name": "string",
"role": "string",
"status": "string",
"last_login": "string",
"auto_groups": [
"string"
],
"is_current": "boolean",
"is_service_user": "boolean",
"is_blocked": "boolean",
"issued": "string"
}
}
]
```
</CodeGroup>
@@ -195,7 +219,38 @@ echo $response;
<Row>
<Col>
Creates a new service user or sends an invite to a regular user
</Col>
#### Request-Body Parameters
<Properties><Property name="email" type="string" required={false}>
User's Email to send invite to
</Property>
<Property name="name" type="string" required={false}>
User's full name
</Property>
<Property name="role" type="string" required={true}>
User's NetBird account role
</Property>
<Property name="auto_groups" type="string[]" required={true}>
Group IDs to auto-assign to peers registered by this user
</Property>
<Property name="is_service_user" type="boolean" required={true}>
Is true if this user is a service user
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="POST" label="/api/users">
@@ -205,14 +260,26 @@ curl -X POST https://api.netbird.io/api/users \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <TOKEN>' \
--data-raw '{
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
});
let config = {
method: 'post',
@@ -241,7 +308,13 @@ import json
url = "https://api.netbird.io/api/users"
payload = json.dumps({
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
})
headers: {
'Content-Type': 'application/json',
@@ -270,7 +343,13 @@ func main() {
method := "POST"
payload := strings.NewReader(`{
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
}`)
client := &http.Client {
}
@@ -317,7 +396,13 @@ request["Accept"] = "application/json"
request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
})
response = https.request(request)
puts response.read_body
@@ -328,7 +413,13 @@ OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/users")
@@ -355,7 +446,13 @@ curl_setopt_array($curl, array(
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"$ref": "#/components/schemas/UserCreateRequest"
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_service_user": false
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
@@ -376,12 +473,36 @@ echo $response;
<CodeGroup title="Response">
```json {{ title: 'Example' }}
{
"$ref": "#/components/schemas/User"
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"last_login": "2023-05-05T09:00:35.477782Z",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_current": true,
"is_service_user": false,
"is_blocked": false,
"issued": "api"
}
```
```json {{ title: 'Schema' }}
{
"$ref": "#/components/schemas/User"
"id": "string",
"email": "string",
"name": "string",
"role": "string",
"status": "string",
"last_login": "string",
"auto_groups": [
"string"
],
"is_current": "boolean",
"is_service_user": "boolean",
"is_blocked": "boolean",
"issued": "string"
}
```
</CodeGroup>
@@ -406,7 +527,28 @@ echo $response;
The unique identifier of a user
</Property>
</Properties>
</Col>
#### Request-Body Parameters
<Properties><Property name="role" type="string" required={true}>
User's NetBird account role
</Property>
<Property name="auto_groups" type="string[]" required={true}>
Group IDs to auto-assign to peers registered by this user
</Property>
<Property name="is_blocked" type="boolean" required={true}>
If set to true then user is blocked and can't use the system
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="PUT" label="/api/users/{userId}">
@@ -416,14 +558,22 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <TOKEN>' \
--data-raw '{
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
});
let config = {
method: 'put',
@@ -452,7 +602,11 @@ import json
url = "https://api.netbird.io/api/users/{userId}"
payload = json.dumps({
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
})
headers: {
'Content-Type': 'application/json',
@@ -481,7 +635,11 @@ func main() {
method := "PUT"
payload := strings.NewReader(`{
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
}`)
client := &http.Client {
}
@@ -528,7 +686,11 @@ request["Accept"] = "application/json"
request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
})
response = https.request(request)
puts response.read_body
@@ -539,7 +701,11 @@ OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/users/{userId}")
@@ -566,7 +732,11 @@ curl_setopt_array($curl, array(
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
"$ref": "#/components/schemas/UserRequest"
"role": "admin",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_blocked": false
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
@@ -587,12 +757,36 @@ echo $response;
<CodeGroup title="Response">
```json {{ title: 'Example' }}
{
"$ref": "#/components/schemas/User"
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"last_login": "2023-05-05T09:00:35.477782Z",
"auto_groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"is_current": true,
"is_service_user": false,
"is_blocked": false,
"issued": "api"
}
```
```json {{ title: 'Schema' }}
{
"$ref": "#/components/schemas/User"
"id": "string",
"email": "string",
"name": "string",
"role": "string",
"status": "string",
"last_login": "string",
"auto_groups": [
"string"
],
"is_current": "boolean",
"is_service_user": "boolean",
"is_blocked": "boolean",
"issued": "string"
}
```
</CodeGroup>